/** * ignore case where xsd:nillable is recognized as false by xsom (we don't know if it's not specified and we want to * preserve a default value to true. Therefore, we provide a custom attribute nxs:nillable to force nillable as * false) NB: if xsd:nillable is present and sets to true, deducted value will be true even if nxs:nillable is false * * @since 7.1 */ protected static boolean isNillable(XSElementDecl element) { String value = element.getForeignAttribute(NAMESPACE_CORE_VALIDATION, "nillable"); return element.isNillable() || value == null || Boolean.parseBoolean(value); }
protected RawTypeSet.Mode canBeType(RawTypeSet parent) { // if we have an adapter or IDness, which requires special // annotation, and there's more than one element, // we have no place to put the special annotation, so we need JAXBElement. if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE) return RawTypeSet.Mode.MUST_BE_REFERENCE; if(parent.refs.size() > 1 && target.getAdapterUse() != null) return RawTypeSet.Mode.MUST_BE_REFERENCE; // nillable and optional at the same time. needs an element wrapper to distinguish those // two states. But this is not a hard requirement. if(decl.isNillable() && parent.mul.isOptional()) return RawTypeSet.Mode.CAN_BE_TYPEREF; return RawTypeSet.Mode.SHOULD_BE_TYPEREF; }
protected RawTypeSet.Mode canBeType(RawTypeSet parent) { // if we have an adapter or IDness, which requires special // annotation, and there's more than one element, // we have no place to put the special annotation, so we need JAXBElement. if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE) return RawTypeSet.Mode.MUST_BE_REFERENCE; if(parent.refs.size() > 1 && target.getAdapterUse() != null) return RawTypeSet.Mode.MUST_BE_REFERENCE; // nillable and optional at the same time. needs an element wrapper to distinguish those // two states. But this is not a hard requirement. if(decl.isNillable() && parent.mul.isOptional()) return RawTypeSet.Mode.CAN_BE_TYPEREF; return RawTypeSet.Mode.SHOULD_BE_TYPEREF; }
protected RawTypeSet.Mode canBeType(RawTypeSet parent) { // if we have an adapter or IDness, which requires special // annotation, and there's more than one element, // we have no place to put the special annotation, so we need JAXBElement. if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE) return RawTypeSet.Mode.MUST_BE_REFERENCE; if(parent.refs.size() > 1 && target.getAdapterUse() != null) return RawTypeSet.Mode.MUST_BE_REFERENCE; // nillable and optional at the same time. needs an element wrapper to distinguish those // two states. But this is not a hard requirement. if(decl.isNillable() && parent.mul.isOptional()) return RawTypeSet.Mode.CAN_BE_TYPEREF; return RawTypeSet.Mode.SHOULD_BE_TYPEREF; }
protected RawTypeSet.Mode canBeType(RawTypeSet parent) { // if we have an adapter or IDness, which requires special // annotation, and there's more than one element, // we have no place to put the special annotation, so we need JAXBElement. if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE) return RawTypeSet.Mode.MUST_BE_REFERENCE; if(parent.refs.size() > 1 && target.getAdapterUse() != null) return RawTypeSet.Mode.MUST_BE_REFERENCE; // nillable and optional at the same time. needs an element wrapper to distinguish those // two states. But this is not a hard requirement. if(decl.isNillable() && parent.mul.isOptional()) return RawTypeSet.Mode.CAN_BE_TYPEREF; return RawTypeSet.Mode.SHOULD_BE_TYPEREF; }
protected RawTypeSet.Mode canBeType(RawTypeSet parent) { // if we have an adapter or IDness, which requires special // annotation, and there's more than one element, // we have no place to put the special annotation, so we need JAXBElement. if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE) return RawTypeSet.Mode.MUST_BE_REFERENCE; if(parent.refs.size() > 1 && target.getAdapterUse() != null) return RawTypeSet.Mode.MUST_BE_REFERENCE; // nillable and optional at the same time. needs an element wrapper to distinguish those // two states. But this is not a hard requirement. if(decl.isNillable() && parent.mul.isOptional()) return RawTypeSet.Mode.CAN_BE_TYPEREF; return RawTypeSet.Mode.SHOULD_BE_TYPEREF; }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
private void processTermElement(JFieldVar fieldVar, XSElementDecl element, List<FacetCustomization> customizations) { XSType elementType = element.getType(); if (elementType.isComplexType()) { validAnnotate(fieldVar); if (!element.isNillable()) notNullAnnotate(fieldVar); if (elementType.getBaseType().isSimpleType()) processSimpleType(elementType.getBaseType().asSimpleType(), fieldVar, customizations); } else processSimpleType(elementType.asSimpleType(), fieldVar, customizations); }
private void processTermElement(XSParticle particle, JFieldVar fieldVar, XSElementDecl element, List<FacetCustomization> customizations) { final int minOccurs = getOccursValue("minOccurs", particle); XSType elementType = element.getType(); if (elementType.isComplexType()) { validAnnotate(fieldVar); if (!element.isNillable() && minOccurs > 0) { notNullAnnotate(fieldVar); } if (elementType.getBaseType().isSimpleType()) { processSimpleType(particle, elementType.getBaseType().asSimpleType(), fieldVar, customizations); } } else { processSimpleType(particle, elementType.asSimpleType(), fieldVar, customizations); } }
boolean nillable = element.isNillable(); System.out.print(indent + "[Element " + absPath + " " + occurs + "] of type [" + typeName + "]" + (nillable ? " [nillable] " : "")); if (element.getType().isComplexType())
if(decl.isNillable())
if(decl.isNillable())