Search in sources :

Example 1 with RestrictionSimpleTypeImpl

use of com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl in project atlasmap by atlasmap.

the class complexType method action13.

private void action13() throws SAXException {
    if (baseContentType == null) {
        // contentType of the base type, which must be a complex type
        baseContentType = new BaseContentSimpleTypeRef(baseType);
    }
    contentSimpleType = new RestrictionSimpleTypeImpl($runtime.document, null, /*?*/
    locator2, null, null, true, Collections.EMPTY_SET, baseContentType);
    contentType = contentSimpleType;
}
Also used : RestrictionSimpleTypeImpl(com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl)

Example 2 with RestrictionSimpleTypeImpl

use of com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl in project BIMserver by opensourceBIM.

the class XSDSchemaReader method createSimpleType.

private void createSimpleType(XSSimpleType simpleType) {
    if (simpleType instanceof RestrictionSimpleTypeImpl) {
        RestrictionSimpleTypeImpl restrictionSimpleTypeImpl = (RestrictionSimpleTypeImpl) simpleType;
        String typeName = restrictionSimpleTypeImpl.getBaseType().getName();
        if (typeName.equals("string")) {
            EEnum eEnum = ecoreFactory.createEEnum();
            eEnum.setName(simpleType.getName());
            ePackage.getEClassifiers().add(eEnum);
            int i = 0;
            for (XSFacet facet : restrictionSimpleTypeImpl.getDeclaredFacets()) {
                EEnumLiteral eEnumLiteral = ecoreFactory.createEEnumLiteral();
                eEnumLiteral.setValue(i++);
                eEnum.getELiterals().add(eEnumLiteral);
                eEnumLiteral.setName(facet.getValue().toString().toUpperCase());
            }
        } else if (typeName.equals("double")) {
            EClass eClass = ecoreFactory.createEClass();
            eClass.setName(simpleType.getName());
            ePackage.getEClassifiers().add(eClass);
        } else if (typeName.equals("normalizedString")) {
            EClass eClass = ecoreFactory.createEClass();
            eClass.setName(simpleType.getName());
            ePackage.getEClassifiers().add(eClass);
        } else if (typeName.equals("boolean")) {
            EClass eClass = ecoreFactory.createEClass();
            eClass.setName(simpleType.getName());
            ePackage.getEClassifiers().add(eClass);
        } else if (typeName.equals("long")) {
            EClass eClass = ecoreFactory.createEClass();
            eClass.setName(simpleType.getName());
            ePackage.getEClassifiers().add(eClass);
        } else {
            EClass eClass = ecoreFactory.createEClass();
            eClass.setName(simpleType.getName());
            ePackage.getEClassifiers().add(eClass);
        }
    } else {
        System.out.println(simpleType.getName());
    }
}
Also used : XSFacet(com.sun.xml.xsom.XSFacet) EClass(org.eclipse.emf.ecore.EClass) RestrictionSimpleTypeImpl(com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl) EEnumLiteral(org.eclipse.emf.ecore.EEnumLiteral) EEnum(org.eclipse.emf.ecore.EEnum)

Aggregations

RestrictionSimpleTypeImpl (com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl)2 XSFacet (com.sun.xml.xsom.XSFacet)1 EClass (org.eclipse.emf.ecore.EClass)1 EEnum (org.eclipse.emf.ecore.EEnum)1 EEnumLiteral (org.eclipse.emf.ecore.EEnumLiteral)1