Examples of XSClass


Examples of org.exolab.castor.builder.types.XSClass

     * Tests get and set of dirty.
     */
    public void testDirty() {
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo isbn = factory.createFieldInfo(
                new XSClass(new JClass("Book")), "isbn");
        isbn.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdo = new JDOFieldInfoNature(isbn);
        jdo.setDirty(true);
        assertEquals(true, jdo.isDirty());
    }
View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

    /**
     * Tests set and get of the _xml schema type.
     */
    public void testSchemaType() {
        JClass jClass = new JClass("Book");
        XSClass xsClass = new XSClass(jClass, "Book");
        _xml.setSchemaType(xsClass);
        assertEquals(xsClass, _xml.getSchemaType());
    }
View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

     * Tests if getFields returns a list of {@link JDOFieldInfoNature}s.
     */
    public void testGetElementFields() {
        ClassInfo classInfo = new ClassInfo(new JClass("test"));
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo field = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "isbn");
        field.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdoField = new JDOFieldInfoNature(field);
        jdoField.setColumnName("isbn");
        jdoField.setColumnType("integer");
View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

     * Tests if getFields returns a list of {@link JDOFieldInfoNature}s.
     */
    public void testGetElementFieldsWithMoreThanOneField() {
        ClassInfo classInfo = new ClassInfo(new JClass("test"));
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo isbn = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "isbn");
        FieldInfo title = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "title");
        isbn.addNature(JDOFieldInfoNature.class.getName());
        title.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdoIsbn = new JDOFieldInfoNature(isbn);
        JDOFieldInfoNature jdoTitle = new JDOFieldInfoNature(title);
View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

     * JDOFieldInfoNature.
     */
    public void testGetElementFieldsWithoutNatures() {
        ClassInfo classInfo = new ClassInfo(new JClass("test"));
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo field = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "isbn");
        classInfo.addFieldInfo(field);
        classInfo.addNature(JDOClassInfoNature.class.getName());
        JDOClassInfoNature jdo = new JDOClassInfoNature(classInfo);

View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

     * Tests if getFields returns a list of {@link JDOFieldInfoNature}s.
     */
    public void testGetElementFieldsOnlyOneHasNature() {
        ClassInfo classInfo = new ClassInfo(new JClass("test"));
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo field = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "isbn");
        FieldInfo field2 = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "abc");
        field.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdoField = new JDOFieldInfoNature(field);
        jdoField.setColumnName("isbn");
        jdoField.setColumnType("integer");
View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

     */
    public void testGetAttributeTextElementFields() {
        ClassInfo classInfo = new ClassInfo(new JClass("test"));
        FieldInfoFactory factory = new FieldInfoFactory();
       
        FieldInfo elementField = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "isbn");
        // Set node type
        elementField.addNature(XMLInfoNature.class.getName());
        new XMLInfoNature(elementField).setNodeType(NodeType.ELEMENT);
        // Set column name
        elementField.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdoField = new JDOFieldInfoNature(elementField);
        jdoField.setColumnName("isbn");
        classInfo.addFieldInfo(elementField);
       
        FieldInfo attributeField = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "title");
        // Set node type
        attributeField.addNature(XMLInfoNature.class.getName());
        new XMLInfoNature(attributeField).setNodeType(NodeType.ATTRIBUTE);
        // Set column name
        attributeField.addNature(JDOFieldInfoNature.class.getName());
        jdoField = new JDOFieldInfoNature(attributeField);
        jdoField.setColumnName("title");
        classInfo.addFieldInfo(attributeField);
       
        FieldInfo textField = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "price");
        // Set node type
        textField.addNature(XMLInfoNature.class.getName());
        new XMLInfoNature(textField).setNodeType(NodeType.TEXT);
        // Set column name
View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

     * SetUp sets the NatureExtendable to test.
     */
    protected void setUp() throws Exception {
        FieldInfoFactory factory = new FieldInfoFactory();
        _extender = factory.createFieldInfo(
                new XSClass(new JClass("Book")), "isbn");
    }
View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

                        //////////////////////////////////////////////////////////
                        return new JClass[0];
                    }
                } else if (type.isAnyType()) {
                    //-- Do not create classes for AnyType
                    xmlNature.setSchemaType(new XSClass(SGTypes.OBJECT));
                    return new JClass[0];
                }
            } else {
                //--no type we must be facing an XML schema group
                //--MODEL GROUP OR GROUP
                createForSingleGroup = processSchemaGroup(component, state, classInfo);
            }

            //6--createGroupItem
            if (createGroupItem) {
                //-- create Bound Properties code
                if (component.hasBoundProperties()) {
                    createPropertyChangeMethods(jClass);
                }

                sgState.bindReference(jClass, classInfo);

                classes[1] = jClass;

                //-- create main group class
                String fname = component.getJavaClassName() + ITEM_NAME;
                fname = getJavaNaming().toJavaMemberName(fname, false);

                FieldInfo fInfo = null;
                if (createForSingleGroup) {
                    //By default a nested group Item can occur only once
                    fInfo = getInfoFactory().createFieldInfo(new XSClass(jClass), fname);
                } else {
                    fInfo = getInfoFactory().createCollection(
                            new XSClass(jClass), "_items", fname, getJavaNaming(), getConfig().useJava50());
                }
                fInfo.setContainer(true);
                String newClassName = className.substring(0, className.length() - 4);
                state = new FactoryState(newClassName, sgState, packageName, component);
                classInfo = state.getClassInfo();
                jClass    = state.getJClass();
                initialize(jClass);
                if (type != null && type.isComplexType()) {
                    ComplexType complexType = (ComplexType) type;
                    if (complexType.isTopLevel() ^ creatingForAnElement) {
                        //process attributes and content type since it has not be performed before
                        Annotated saved = component.getAnnotated();
                        processAttributes(component.getBinding(), complexType, state);
                        component.setView(saved);
                        if (complexType.getContentType() == ContentType.mixed) {
                            FieldInfo fieldInfo = _memberFactory.createFieldInfoForContent(
                                    component, new XSString(), getConfig().useJava50());
                            handleField(fieldInfo, state, component);
                        } else if (complexType.getContentType().getType() == ContentType.SIMPLE) {
                            SimpleContent simpleContent = (SimpleContent) complexType.getContentType();
                            SimpleType temp = simpleContent.getSimpleType();
                            XSType xsType = _typeConversion.convertType(
                                    temp, packageName, getConfig().useJava50());
                            FieldInfo fieldInfo = _memberFactory.createFieldInfoForContent(
                                    component, xsType, getConfig().useJava50());
                            handleField(fieldInfo, state, component);
                            temp = null;
                        } else {
                            // handle multi-valued choice group
                            xmlNature.setSchemaType(new XSClass(jClass));
                        }
                    }
                }

                classInfo.addFieldInfo(fInfo);
View Full Code Here

Examples of org.exolab.castor.builder.types.XSClass

                tmpClass = tmpInfo.getJClass();
            } else {
                tmpClass = createSourceCode(component.getBinding(), simpleType, sgState);
            }
            XMLInfoNature xmlNature = new XMLInfoNature(classInfo);
            xmlNature.setSchemaType(new XSClass(tmpClass));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.