protected void initialize(EAttribute eAttribute, XSDSimpleTypeDefinition xsdSimpleTypeDefinition) { if (XSDConstants.isOrIsDerivedFromID(xsdSimpleTypeDefinition)) { eAttribute.setID(true); } // If there is no default value but the type has enumeration facets and the value is a primitive... // if (!eAttribute.isMany() && eAttribute.getDefaultValueLiteral() == null && xsdSimpleTypeDefinition != null && xsdSimpleTypeDefinition.getEffectiveEnumerationFacet() != null && eAttribute.getEType().getDefaultValue() != null) { // Set the default to the first enumeration's value. // eAttribute.setDefaultValueLiteral ((xsdSimpleTypeDefinition. getEffectiveEnumerationFacet(). getSimpleTypeDefinition(). getEnumerationFacets(). get(0)).getLexicalValue()); } }
return isMany()? null : eType.getDefaultValue();
return isMany()? null : eType.getDefaultValue();
protected void initialize(EAttribute eAttribute, XSDSimpleTypeDefinition xsdSimpleTypeDefinition) { if (XSDConstants.isOrIsDerivedFromID(xsdSimpleTypeDefinition)) { eAttribute.setID(true); } // If there is no default value but the type has enumeration facets and the value is a primitive... // if (!eAttribute.isMany() && eAttribute.getDefaultValueLiteral() == null && xsdSimpleTypeDefinition != null && xsdSimpleTypeDefinition.getEffectiveEnumerationFacet() != null && eAttribute.getEType().getDefaultValue() != null && !(eAttribute.getEType() instanceof EEnum)) { // Set the default to the first enumeration's value. // setDefaultValueLiteral (eAttribute, xsdSimpleTypeDefinition.getNormalizedLiteral ((xsdSimpleTypeDefinition. getEffectiveEnumerationFacet(). getSimpleTypeDefinition(). getEnumerationFacets(). get(0)).getLexicalValue())); } }
protected void createAttributeElementDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition); XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(getName(attribute)); // If the attribute can have a null value (primitives and enums can't), and // if the attribute can hold many nulls or // it can hold only a single value that is allowed to be null // and it can be considered set when it has the null value... // if (attribute.getEType().getDefaultValue() == null && (attribute.isMany() || (!attribute.isRequired() && (attribute.getDefaultValueLiteral() != null || attribute.isUnsettable())))) { xsdElementDeclaration.setNillable(true); } if (xsdElementDeclaration.isNillable() || attribute.isMany() || !minimizedXMI) { XSDSimpleTypeDefinition attrType = getType(attribute.getEAttributeType()); if (attrType != null) { xsdElementDeclaration.setTypeDefinition(attrType); } XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(xsdElementDeclaration); setAttributeElementMultiplicity(attribute, particle); modelGroup.getContents().add(particle); map(particle, attribute); } }
protected void createAttributeElementDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition); XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(getName(attribute)); // If the attribute can have a null value (primitives and enums can't), and // if the attribute can hold many nulls or // it can hold only a single value that is allowed to be null // and it can be considered set when it has the null value... // if (attribute.getEType().getDefaultValue() == null && (attribute.isMany() || (!attribute.isRequired() && (attribute.getDefaultValueLiteral() != null || attribute.isUnsettable())))) { xsdElementDeclaration.setNillable(true); } if (xsdElementDeclaration.isNillable() || attribute.isMany() || !minimizedXMI) { XSDSimpleTypeDefinition attrType = getType(attribute.getEAttributeType()); if (attrType != null) { xsdElementDeclaration.setTypeDefinition(attrType); } XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(xsdElementDeclaration); setAttributeElementMultiplicity(attribute, particle); modelGroup.getContents().add(particle); map(particle, attribute); } }
else if ((eStructuralFeature.getEType().getDefaultValue() != null || eStructuralFeature.getDefaultValueLiteral() != null) != eStructuralFeature.isUnsettable())
if (maxOccurs == 1 && (type.getDefaultValue() != null || eAttribute.getDefaultValueLiteral() != null))
if (maxOccurs == 1 && (type.getDefaultValue() != null || eAttribute.getDefaultValueLiteral() != null))
eType.getDefaultValue() == null && (eStructuralFeature.isMany() || (!eStructuralFeature.isRequired() && (eType.getDefaultValue() != null || eStructuralFeature.getDefaultValueLiteral() != null) != eStructuralFeature.isUnsettable())
eType.getDefaultValue() == null && (eStructuralFeature.isMany() || (!eStructuralFeature.isRequired() && (eType.getDefaultValue() != null || eStructuralFeature.getDefaultValueLiteral() != null) != eStructuralFeature.isUnsettable())
else if ((eStructuralFeature.getEType().getDefaultValue() != null || eStructuralFeature.getDefaultValueLiteral() != null) != eStructuralFeature.isUnsettable())
Class<?> dataClass = EcoreUtil.wrapperClassFor(instanceClass); Object defaultValue = getDefaultValue(); Object intrinsicDefaultValue = eType.getDefaultValue();
Class<?> dataClass = EcoreUtil.wrapperClassFor(instanceClass); Object defaultValue = getDefaultValue(); Object intrinsicDefaultValue = eType.getDefaultValue();