Package org.jibx.custom.classes

Examples of org.jibx.custom.classes.ClassCustom


    };
   
    public void testOverrides() throws Exception {
        BindGenCommandLine cmd = new BindGenCommandLine();
        assertTrue("Basic argument processing", cmd.processArgs(OVERRIDE_ARGS));
        ClassCustom clas = cmd.getGlobal().addClassCustomization("org.jibx.binding.generator.DataClass1");
        assertFalse("property-access setting", clas.isPropertyAccess());
        assertEquals("namespace-style setting", CustomBase.DERIVE_FIXED, clas.getNamespaceStyle());
        assertEquals("namespace setting", "http://www.sosnoski.com/ws", clas.getNamespace());
        assertEquals("name-style setting", CustomBase.CAMEL_CASE_NAMES, clas.getNameStyle());
        assertEquals("derived name", "dataClass1", clas.getElementName());
        Collection members = clas.getMembers();
        assertEquals("property count", 4, members.size());
        ValueCustom member = clas.getMember("boolean");
        assertNotNull("boolean member", member);
        assertEquals("boolean type", "boolean", member.getWorkingType());
        assertEquals("boolean name", "boolean", member.getXmlName());
        assertFalse("boolean required", member.isRequired());
        member = clas.getMember("int");
        assertNotNull("int member", member);
        assertEquals("int type", "int", member.getWorkingType());
        assertEquals("int name", "int", member.getXmlName());
        assertFalse("int required", member.isRequired());
        member = clas.getMember("linked");
        assertNotNull("linked member", member);
        assertEquals("linked type", "org.jibx.binding.generator.DataClass1", member.getWorkingType());
        assertEquals("linked name", "linked", member.getXmlName());
        assertFalse("linked required", member.isRequired());
        member = clas.getMember("string");
        assertNotNull("string member", member);
        assertEquals("string type", "java.lang.String", member.getWorkingType());
        assertEquals("string name", "string", member.getXmlName());
        assertFalse("string required", member.isRequired());
    }
View Full Code Here


        "  </package>\n" +
        "</custom>";
   
    public void testSimplePropertiesClass() throws Exception {
        GlobalCustom custom = readCustom(SIMPLE_PROPERTIES_CLASS);
        ClassCustom clas = custom.getClassCustomization("org.jibx.binding.generator.DataClass1");
        assertTrue("property-access setting", clas.isPropertyAccess());
        Collection members = clas.getMembers();
        assertEquals("property count", 4, members.size());
        ValueCustom member = clas.getMember("boolean");
        assertNotNull("boolean member", member);
        assertEquals("boolean type", "boolean", member.getWorkingType());
        assertEquals("boolean name", "boolean", member.getXmlName());
        assertTrue("boolean required", member.isRequired());
        member = clas.getMember("int");
        assertNotNull("int member", member);
        assertEquals("int type", "int", member.getWorkingType());
        assertEquals("int name", "int", member.getXmlName());
        assertTrue("int required", member.isRequired());
        member = clas.getMember("linked");
        assertNotNull("linked member", member);
        assertEquals("linked type", "org.jibx.binding.generator.DataClass1", member.getWorkingType());
        assertEquals("linked name", "linked", member.getXmlName());
        assertFalse("linked required", member.isRequired());
        member = clas.getMember("string");
        assertNotNull("string member", member);
        assertEquals("string type", "java.lang.String", member.getWorkingType());
        assertEquals("string name", "string", member.getXmlName());
        assertFalse("string required", member.isRequired());
    }
View Full Code Here

        assertFalse("string required", member.isRequired());
    }
   
    public void testMultipleFieldsClasses() throws Exception {
        GlobalCustom custom = readCustom(MULTIPLE_FIELDS_CLASSES);
        ClassCustom clas = custom.getClassCustomization("org.jibx.binding.generator.DataClass2");
        Collection members = clas.getMembers();
        assertEquals("property count", 1, members.size());
        ValueCustom member = clas.getMember("dataClass1s");
        assertNotNull("dataClass1s member", member);
        assertEquals("dataClass1s type", "java.util.List", member.getWorkingType());
        assertEquals("dataClass1s name", "dataClass1s", member.getXmlName());
        assertTrue("dataClass1s collection", member.isCollection());
        assertEquals("dataClass1s type", "java.lang.Object", member.getItemType());
        assertEquals("dataClass1s name", "dataClass1", member.getItemName());
        clas = custom.getClassCustomization("org.jibx.binding.generator.DataClass1");
        members = clas.getMembers();
        assertEquals("property count", 4, members.size());
        member = clas.getMember("boolean");
        assertNotNull("boolean member", member);
        assertEquals("boolean type", "boolean", member.getWorkingType());
        assertEquals("boolean name", "boolean", member.getXmlName());
        assertFalse("boolean required", member.isRequired());
        member = clas.getMember("int");
        assertNotNull("int member", member);
        assertEquals("int type", "int", member.getWorkingType());
        assertEquals("int name", "int", member.getXmlName());
        assertFalse("int required", member.isRequired());
        member = clas.getMember("linked");
        assertNotNull("linked member", member);
        assertEquals("linked type", "org.jibx.binding.generator.DataClass1", member.getWorkingType());
        assertEquals("linked name", "linked", member.getXmlName());
        assertFalse("linked required", member.isRequired());
        member = clas.getMember("string");
        assertNotNull("string member", member);
        assertEquals("string type", "java.lang.String", member.getWorkingType());
        assertEquals("string name", "string", member.getXmlName());
        assertTrue("string required", member.isRequired());
    }
View Full Code Here

        assertTrue("string required", member.isRequired());
    }
   
    public void testMultiplePropertiesClasses() throws Exception {
        GlobalCustom custom = readCustom(MULTIPLE_PROPERTIES_CLASSES);
        ClassCustom clas = custom.getClassCustomization("org.jibx.binding.generator.DataClass2");
        Collection members = clas.getMembers();
        assertEquals("property count", 1, members.size());
        ValueCustom member = clas.getMember("dataClass1s");
        assertNotNull("dataClass1s member", member);
        assertEquals("dataClass1s type", "java.util.List", member.getWorkingType());
        assertEquals("dataClass1s name", "dataClass1s", member.getXmlName());
        assertFalse("dataClass1s required", member.isRequired());
        assertTrue("dataClass1s collection", member.isCollection());
        assertEquals("dataClass1s type", "org.jibx.binding.generator.DataClass1", member.getItemType());
        assertEquals("dataClass1s name", "dataClass1", member.getItemName());
        clas = custom.getClassCustomization("org.jibx.binding.generator.DataClass1");
        members = clas.getMembers();
        assertEquals("property count", 4, members.size());
        member = clas.getMember("boolean");
        assertNotNull("boolean member", member);
        assertEquals("boolean type", "boolean", member.getWorkingType());
        assertEquals("boolean name", "boolean", member.getXmlName());
        assertTrue("boolean required", member.isRequired());
        member = clas.getMember("int");
        assertNotNull("int member", member);
        assertEquals("int type", "int", member.getWorkingType());
        assertEquals("int name", "int", member.getXmlName());
        assertFalse("int required", member.isRequired());
        member = clas.getMember("linked");
        assertNotNull("linked member", member);
        assertEquals("linked type", "org.jibx.binding.generator.DataClass1", member.getWorkingType());
        assertEquals("linked name", "linked", member.getXmlName());
        assertFalse("linked required", member.isRequired());
        member = clas.getMember("string");
        assertNotNull("string member", member);
        assertEquals("string type", "java.lang.String", member.getWorkingType());
        assertEquals("string name", "string", member.getXmlName());
        assertFalse("string required", member.isRequired());
    }
View Full Code Here

        assertFalse("string required", member.isRequired());
    }
   
    public void testNonstandardPropertiesClasses() throws Exception {
        GlobalCustom custom = readCustom(NONSTANDARD_PROPERTIES_CLASSES);
        ClassCustom clas = custom.getClassCustomization("org.jibx.binding.generator.DataClass2");
        Collection members = clas.getMembers();
        assertEquals("property count", 2, members.size());
        ValueCustom member = clas.getMember("dataClass1s");
        assertNotNull("dataClass1s member", member);
        assertEquals("dataClass1s type", "java.util.List", member.getWorkingType());
        assertEquals("dataClass1s name", "dataClass1s", member.getXmlName());
        assertFalse("dataClass1s required", member.isRequired());
        assertTrue("dataClass1s collection", member.isCollection());
        assertEquals("dataClass1s type", "org.jibx.binding.generator.DataClass1", member.getItemType());
        assertEquals("dataClass1s name", "dataClass1", member.getItemName());
        assertEquals("property count", 2, members.size());
        member = clas.getMember("nonstandardValue");
        assertNotNull("value member", member);
        assertEquals("value type", "int", member.getWorkingType());
        assertEquals("value name", "nonstandardValue", member.getXmlName());
        assertFalse("value required", member.isRequired());
        assertFalse("value collection", member.isCollection());
View Full Code Here

     * @param type
     */
    private void countEnumUsage(String type) {
        EnumDetail detail = (EnumDetail)m_enumMap.get(type);
        if (detail == null) {
            ClassCustom custom = m_custom.addClassCustomization(type);
            detail = new EnumDetail(custom);
            m_enumMap.put(type, detail);
            if (custom.isForceMapping()) {
                detail.setGlobal(true);
            }
        } else {
            detail.setGlobal(true);
        }
View Full Code Here

                }
            }
        }
       
        // get the names for this mapping
        ClassCustom custom = m_custom.addClassCustomization(map.getClassName());
        QName tname = map.getTypeQName();
        if (tname == null) {
            NamespaceElement dfltns = map.getDefinitions().getElementDefaultNamespace();
            if (dfltns != null) {
                tname = new QName(dfltns.getUri(), custom.getTypeQName().getName());
            } else {
                tname = custom.getTypeQName();
            }
        }
        QName oname = null;
        String name = map.getName();
        if (name == null) {
            oname = custom.getElementQName();
        } else {
            oname = new QName(map.getNamespace().getUri(), name);
        }
       
        // add new mapping detail based on information found
View Full Code Here

                    suffix = "Set";
                } else {
                    suffix = "Collection";
                }
                String itype = value.getItemType();
                ClassCustom cust = global.addClassCustomization(itype);
               
                // register the type name for mapping
                String name = cust.getSimpleName() + suffix;
                String uri = bind.getNamespace();
                qname = new QName(uri, CustomBase.convertName(name, CustomBase.CAMEL_CASE_NAMES));
                mapping.setTypeQName(qname);
                bind.addTypeNameReference(uri, uri);
                typemap.put(ptype, qname);
View Full Code Here

            // generate services, bindings, and WSDLs
            Jibx2Wsdl inst = new Jibx2Wsdl(parms);
            ArrayList extras = new ArrayList(parms.getExtraTypes());
            ArrayList classes = parms.getGlobal().getUnmarshalledClasses();
            for (int i = 0; i < classes.size(); i++) {
                ClassCustom clas = (ClassCustom)classes.get(i);
                if (clas.isForceMapping()) {
                    extras.add(clas.getName());
                }
            }
            List wsdls = inst.generate(parms.getExtraArgs(), extras, classelems, elemschemas, classtypes, typeschemas,
                exists);
            if (wsdls != null) {
View Full Code Here

        String tname = comp.getType().getName();
        QName qname = Types.schemaType(tname);
        if (qname == null) {
            qname = (QName)m_classSimpletypes.get(tname);
            if (qname == null) {
                ClassCustom custom = m_custom.getClassCustomization(type.getName());
                if (custom != null && custom.isSimpleValue()) {
                    qname = Types.STRING_QNAME;
                } else if (!type.isSuperclass("java.lang.Enum")) {
                    m_context.addWarning("No schema equivalent known for type - treating as string", comp);
                    qname = Types.STRING_QNAME;
                }
View Full Code Here

TOP

Related Classes of org.jibx.custom.classes.ClassCustom

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.