schema.createEAttribute(geometryData, "nrIndices", EcorePackage.eINSTANCE.getEInt()).setDefaultValueLiteral("0"); schema.createEAttribute(geometryData, "nrVertices", EcorePackage.eINSTANCE.getEInt()).setDefaultValueLiteral("0"); schema.createEAttribute(geometryData, "nrNormals", EcorePackage.eINSTANCE.getEInt()).setDefaultValueLiteral("0"); schema.createEAttribute(geometryData, "nrColors", EcorePackage.eINSTANCE.getEInt()).setDefaultValueLiteral("0");
@Override public Object caseEAttribute(EAttribute eAttribute) { try { eAttribute.getDefaultValue(); } catch (Exception e) { eAttribute.setDefaultValueLiteral(null); } return eAttribute; }
/** * Handle difference lexical representations for default values, * in particular, positive and negative infinity for float and double. * @since 2.8 */ protected void setDefaultValueLiteral(EAttribute eAttribute, String defaultValue) { EDataType eAttributeType = eAttribute.getEAttributeType(); if (eAttributeType != null) { String instanceTypeName = eAttributeType.getInstanceTypeName(); if (instanceTypeName == "java.lang.Float" || instanceTypeName == "java.lang.Double" || instanceTypeName == "float" || instanceTypeName == "double") { if ("INF".equals(defaultValue)) { defaultValue = "Infinity"; } else if ("-INF".equals(defaultValue)) { defaultValue = "-Infinity"; } } } eAttribute.setDefaultValueLiteral(defaultValue); }
@Override public EAttribute convert() throws LoadModelException { EAttribute result = super.convert(); result.setDefaultValueLiteral(getXmlElement().getDefault()); EMFUtil.setAnnotation(result, IAttributeConstant.ANNOTATION_KEY_RUNTIME, Boolean.toString(getXmlElement().isRuntime())); return result; }
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()); } }
eAttribute.setDefaultValueLiteral(default_);
eAttribute.setDefaultValueLiteral(defaultValue); initialize(eAttribute, (XSDSimpleTypeDefinition)getEffectiveTypeDefinition(xsdAttributeUse, xsdAttributeDeclaration)); extendedMetaData.setNamespace(eAttribute, xsdAttributeDeclaration.getTargetNamespace()); eAttribute.setDefaultValueLiteral(xsdAttributeDeclaration.getLexicalValue()); initialize(eAttribute, (XSDSimpleTypeDefinition)getEffectiveTypeDefinition(null, xsdAttributeDeclaration)); extendedMetaData.setNamespace(eAttribute, xsdElementDeclaration.getTargetNamespace()); eAttribute.setDefaultValueLiteral(xsdElementDeclaration.getLexicalValue()); XSDTypeDefinition xsdType = getEffectiveTypeDefinition(xsdComponent, xsdElementDeclaration); if (xsdType instanceof XSDSimpleTypeDefinition) extendedMetaData.setNamespace(eAttribute, xsdElementDeclaration.getTargetNamespace()); eAttribute.setDefaultValueLiteral(xsdElementDeclaration.getLexicalValue()); XSDTypeDefinition xsdType = getEffectiveTypeDefinition(null, xsdElementDeclaration); if (xsdType instanceof XSDSimpleTypeDefinition)