Package org.exolab.castor.xml.schema

Examples of org.exolab.castor.xml.schema.Facet


                            schema.getBuiltInTypeName(SimpleTypesFactory.NOTATION_TYPE),
                                                                        "restriction");
           Iterator values = dtdAttribute.getValues();
           FacetFactory facetFactory = FacetFactory.getInstance();
           while (values.hasNext()) {
            Facet facet = facetFactory.createFacet(
                       Facet.ENUMERATION, (String) values.next());
            facet.setOwningType(type);
            type.addFacet(facet);
           }

       }
       else if (dtdAttribute.isEnumerationType())
       {
          type = schema.createSimpleType(null,
                            schema.getBuiltInTypeName(SimpleTypesFactory.NMTOKEN_TYPE),
                                                                        "restriction");
          Iterator values = dtdAttribute.getValues();
          FacetFactory facetFactory = FacetFactory.getInstance();
          while (values.hasNext()) {
            Facet facet = facetFactory.createFacet(
                     Facet.ENUMERATION, (String)values.next());
            facet.setOwningType(type);
            type.addFacet(facet);
          }
       }
       else
       {
View Full Code Here


     * Gets the pattern facet
     * returns null if there is none
    **/
    String getPattern()
    {
        Facet patternFacet= getFacet(Facet.PATTERN);
        if (patternFacet == null) return null;
        return patternFacet.getValue();
    }
View Full Code Here

     * (both are never defined at the same time)
     * returns null if there is no minimum
    **/
    Facet getMin()
    {
        Facet minInclusiveFacet= getFacet(Facet.MIN_INCLUSIVE);
        if (minInclusiveFacet != null) return minInclusiveFacet;

        Facet minExclusiveFacet= getFacet(Facet.MIN_EXCLUSIVE);
        if (minExclusiveFacet != null) return minExclusiveFacet;

        return null;
    }
View Full Code Here

     * (both are never defined at the same time)
     * returns null if there is no maximum
    **/
    Facet getMax()
    {
        Facet maxInclusiveFacet= getFacet(Facet.MAX_INCLUSIVE);
        if (maxInclusiveFacet != null) return maxInclusiveFacet;

        Facet maxExclusiveFacet= getFacet(Facet.MAX_EXCLUSIVE);
        if (maxExclusiveFacet != null) return maxExclusiveFacet;

        return null;
    }
View Full Code Here

        else if (SchemaNames.SIMPLE_TYPE.equals(name)) {
            SimpleType type = (SimpleType) unmarshaller.getObject();
            _typeDefinition.setBaseType(type);
        }
        else {
            Facet facet = (Facet) unmarshaller.getObject();
            facet.setOwningType((SimpleType) _typeDefinition.getBaseType());
            _typeDefinition.addFacet(facet);
        }


        unmarshaller = null;
View Full Code Here

                    SimpleContent simpleContent = (SimpleContent)complexType.getContentType();
                    SimpleType simpleType = simpleContent.getSimpleType();
                    //-- process facets
                    Enumeration enumeration = simpleType.getLocalFacets();
                    while (enumeration.hasMoreElements()) {
                        Facet facet = (Facet) enumeration.nextElement();
                        _atts.clear();
                        _atts.addAttribute(SchemaNames.VALUE_ATTR, CDATA,
                                           facet.getValue());
                        String facetName = schemaPrefix + facet.getName();
                        _handler.startElement(facetName, _atts);
                        Enumeration annotations = facet.getAnnotations();
                        while (annotations.hasMoreElements()) {
                            Annotation annotation = (Annotation)annotations.nextElement();
                            processAnnotation(annotation, schemaPrefix);
                        }
                       _handler.endElement(facetName);
View Full Code Here

            _handler.startElement(ELEM_RESTRICTION, _atts);

            //-- process facets
            Enumeration enumeration = simpleType.getLocalFacets();
            while (enumeration.hasMoreElements()) {
                Facet facet = (Facet) enumeration.nextElement();
                _atts.clear();
                _atts.addAttribute(SchemaNames.VALUE_ATTR, CDATA,
                    facet.getValue());
                String facetName = schemaPrefix + facet.getName();
                _handler.startElement(facetName, _atts);
                Enumeration annotations = facet.getAnnotations();
                while (annotations.hasMoreElements()) {
                    Annotation annotation = (Annotation)annotations.nextElement();
                    processAnnotation(annotation, schemaPrefix);
                }
                _handler.endElement(facetName);
View Full Code Here

        //-- Loop through "enumeration" facets
        int count = 0;

        while (enumeration.hasMoreElements()) {
            Facet facet = (Facet) enumeration.nextElement();

            String value = facet.getValue();

            String typeName = null;
            String objName  = null;

            if (useValuesAsName) {
View Full Code Here

        constructor.setModifiers(modifiers);
        jEnum.addConstructor(constructor);

        int enumCount = 0;
        while (enumeration.hasMoreElements()) {
            Facet facet = (Facet) enumeration.nextElement();
            JEnumConstant enumConstant;
            if (useValuesAsName) {
                enumConstant = new JEnumConstant(
                        translateEnumValueToIdentifier(component.getEnumBinding(), facet),
                        new String[]{"\"" + facet.getValue() "\""});
            } else {
                enumConstant = new JEnumConstant(
                        "VALUE_" + enumCount, new String[]{"\""
                                + facet.getValue() + "\""});
            }
           
            // custom annotations
            for (int i = 0; i < annotationBuilders.length; i++) {
                AnnotationBuilder annotationBuilder = annotationBuilders[i];
View Full Code Here

            final Enumeration<Facet> enumeration, final boolean useValuesAsName) {
        boolean duplicateTranslation = false;
        short numberOfTranslationToSpecialCharacter = 0;

        while (enumeration.hasMoreElements()) {
            Facet facet = enumeration.nextElement();
            String possibleId = translateEnumValueToIdentifier(component.getEnumBinding(), facet);
            if (possibleId.equals("_")) {
                numberOfTranslationToSpecialCharacter++;
                if (numberOfTranslationToSpecialCharacter > 1) {
                    duplicateTranslation = true;
View Full Code Here

TOP

Related Classes of org.exolab.castor.xml.schema.Facet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.