Search in sources :

Example 1 with BooleanType

use of nl.tue.buildingsmart.schema.BooleanType in project BIMserver by opensourceBIM.

the class Express2EMF method x.

private EAttribute x(DefinedType type, EClass testType) {
    EAttribute wrapperAttrib = eFactory.createEAttribute();
    wrapperAttrib.setName("wrappedValue");
    if (type.getDomain() instanceof IntegerType) {
        wrapperAttrib.setEType(ePackage.getELong());
    } else if (type.getDomain() instanceof RealType) {
        wrapperAttrib.setEType(ePackage.getEDouble());
    } else if (type.getDomain() instanceof StringType) {
        wrapperAttrib.setEType(ePackage.getEString());
    } else if (type.getDomain() instanceof BooleanType) {
        wrapperAttrib.setEType(schemaPack.getEClassifier("Tristate"));
    } else if (type.getDomain() instanceof NumberType) {
        wrapperAttrib.setEType(ePackage.getEDouble());
    } else if (type.getDomain() instanceof BinaryType) {
        wrapperAttrib.setEType(ePackage.getEByteArray());
    } else if (type.getDomain() instanceof LogicalType) {
        wrapperAttrib.setEType(schemaPack.getEClassifier("Tristate"));
    }
    wrapperAttrib.setUnsettable(true);
    testType.getEStructuralFeatures().add(wrapperAttrib);
    if (wrapperAttrib.getEType() == ePackage.getEDouble()) {
        EAttribute doubleStringAttribute = eFactory.createEAttribute();
        doubleStringAttribute.setEType(ePackage.getEString());
        doubleStringAttribute.setName("wrappedValueAsString");
        doubleStringAttribute.getEAnnotations().add(createAsStringAnnotation());
        doubleStringAttribute.getEAnnotations().add(createHiddenAnnotation());
        doubleStringAttribute.setUnsettable(true);
        testType.getEStructuralFeatures().add(doubleStringAttribute);
    }
    return wrapperAttrib;
}
Also used : IntegerType(nl.tue.buildingsmart.schema.IntegerType) EAttribute(org.eclipse.emf.ecore.EAttribute) NumberType(nl.tue.buildingsmart.schema.NumberType) BinaryType(nl.tue.buildingsmart.schema.BinaryType) StringType(nl.tue.buildingsmart.schema.StringType) BooleanType(nl.tue.buildingsmart.schema.BooleanType) LogicalType(nl.tue.buildingsmart.schema.LogicalType) RealType(nl.tue.buildingsmart.schema.RealType)

Aggregations

BinaryType (nl.tue.buildingsmart.schema.BinaryType)1 BooleanType (nl.tue.buildingsmart.schema.BooleanType)1 IntegerType (nl.tue.buildingsmart.schema.IntegerType)1 LogicalType (nl.tue.buildingsmart.schema.LogicalType)1 NumberType (nl.tue.buildingsmart.schema.NumberType)1 RealType (nl.tue.buildingsmart.schema.RealType)1 StringType (nl.tue.buildingsmart.schema.StringType)1 EAttribute (org.eclipse.emf.ecore.EAttribute)1