Examples of IClass


Examples of org.jibx.util.IClass

            m_private = Modifier.isPrivate(field.getAccessFlags());
            type = field.getTypeName();
        }
       
        // fill in the details of type information
        IClass info = icl.getClassInfo(type);
        fillType(info, req, style);
        if (isCollection()) {
            if (getItemType() == null) {
                String tname = getWorkingType();
                if (tname.endsWith("[]")) {
View Full Code Here

Examples of org.jibx.util.IClass

        ClassCustom clas = m_global.addClassCustomization(type);
        if (clas.isSimpleValue()) {
            m_formatSet.add(type);
            return true;
        }
        IClass sinfo = clas.getClassInformation().getSuperClass();
        if (sinfo != null && "java.lang.Enum".equals(sinfo.getName())) {
            return true;
        } else {
            return false;
        }
    }
View Full Code Here

Examples of org.jibx.util.IClass

                }
               
            }
           
            // check if need to use superclass in binding
            IClass clas = cust.getClassInformation();
            IClass sclas = clas.getSuperClass();
            String stype = sclas.getName();
            Map exmethmap = Collections.EMPTY_MAP;
            if (checkInclude(stype)) {
               
                // check if any added content from this class
                ClassCustom scust = m_global.getClassCustomization(stype);
                exmethmap = new HashMap();
                if (cust.getMembers().size() > 0) {
                   
                    // add child <structure> element for superclass, followed by content from this class
                    StructureElement sstruct = new StructureElement();
                    sstruct.setDeclaredType(stype);
                    fillStructure(scust, null, exmethmap, sstruct, hold);
                    struct.addChild(sstruct);
                   
                } else {
                   
                    // just replace class reference with superclass reference in existing <structure>
                    struct.setDeclaredType(stype);
                    fillStructure(scust, null, exmethmap, struct, hold);
                   
                }
               
            } else {
               
                // check for interface with abstract mapping to reference
                String[] intfs = sclas.getInterfaces();
                for (int i = 0; i < intfs.length; i++) {
                    String intf = intfs[i];
                    BindingMappingDetail idetail = (BindingMappingDetail)m_mappingDetailsMap.get(intf);
                    if (idetail != null && idetail.isUseAbstract() && idetail.getTypeQName() == null) {
                       
View Full Code Here

Examples of org.jibx.util.IClass

        // create the basic mapping structure(s)
        ClassCustom cust = m_global.addClassCustomization(type);
        MappingElementBase mainmapping = null;
        QName qname = null;
        MappingElementBase mapcon = null;
        IClass clas = cust.getClassInformation();
        if (detail.isUseConcrete()) {
           
            // create concrete mapping
            mapcon = createMapping(type, cust);
            qname = detail.getElementQName();
            mapcon.setName(qname.getName());
            detail.setConcreteMapping(mapcon);
           
            // make "concrete" mapping abstract if no class creation possible
            if (clas.isAbstract() || clas.isInterface()) {
                mapcon.setAbstract(true);
            }
           
            // fill details directly to this mapping unless abstract also created
            mainmapping = mapcon;
           
        }
        MappingElement mapabs = null;
        if (detail.isUseAbstract()) {
           
            // create abstract mapping
            mapabs = createMapping(type, cust);
            mapabs.setAbstract(true);
            qname = detail.getTypeQName();
            mapabs.setTypeQName(qname);
            detail.setAbstractMapping(mapabs);
           
            // use abstract mapping for details (concrete will reference this one)
            mainmapping = mapabs;
           
        }
        if (mainmapping != null) {
           
            // find the binding containing this mapping
            String uri = qname.getUri();
            BindingHolder hold = m_directory.getBinding(uri);
            if (mainmapping.isAbstract()) {
                hold.addTypeNameReference(uri, uri);
            }
           
            // check for superclass mapping to be extended (do this first for compatibility with schema type extension)
            StructureElement struct = null;
            String ptype = detail.getExtendsType();
            Map exmembmap = Collections.EMPTY_MAP;
            Map inmembmap = new HashMap();
            if (ptype == null) {
               
                // not extending a base mapping, check if need to include superclass
                IClass parent = clas.getSuperClass();
                if (cust.isUseSuper() && parent != null) {
                    ptype = parent.getName();
                    if (checkInclude(ptype)) {
                        struct = new StructureElement();
                        struct.setDeclaredType(ptype);
                        ClassCustom scust = m_global.getClassCustomization(ptype);
                        exmembmap = new HashMap();
View Full Code Here

Examples of org.jibx.util.IClass

        BindingMappingDetail detail = (BindingMappingDetail)m_mappingDetailsMap.get(type);
        if (detail == null) {
           
            // provide warning when interface used with field access
            ClassCustom cust = m_global.getClassCustomization(type);
            IClass sclas = cust.getClassInformation();
            if (sclas.isInterface() && !cust.isPropertyAccess()) {
                System.out.println("Warning: generating mapping for interface " + type +
                    " without checking properties - consider setting property-access='true'");
            }
           
            // check if a superclass is base for extension
            String stype = null;
            Boolean isabs = null;
            while ((sclas = sclas.getSuperClass()) != null) {
                if (m_directSet.contains(sclas.getName())) {
                    stype = sclas.getName();
                    isabs = Boolean.valueOf(sclas.isAbstract());
                    break;
                }
            }
            // TODO: really should check for multiple superclasses/interfaces to
            // be handled (and generate a warning, since they can't be handled)
            if (stype == null) {
               
                // check if an interface is base for extension
                sclas = cust.getClassInformation();
                loop: while (sclas != null) {
                    String[] intfs = sclas.getInterfaces();
                    for (int i = 0; i < intfs.length; i++) {
                        String itype = intfs[i];
                        while (true) {
                            if (m_directSet.contains(itype)) {
                                stype = itype;
                                isabs = Boolean.TRUE;
                                break loop;
                            } else {
                                ClassCustom icust = m_global.getClassCustomization(itype);
                                if (icust == null) {
                                    break;
                                } else {
                                   
                                    // check for interface (should only ever be one) of interface
                                    String[] sintfs = icust.getClassInformation().getInterfaces();
                                    if (sintfs.length > 0) {
                                        itype = sintfs[0];
                                    } else {
                                        break;
                                    }
                                   
                                }
                            }
                        }
                    }
                    sclas = sclas.getSuperClass();
                }
            }
            if (stype != null) {
                BindingMappingDetail sdetail = addMappingDetails(isabs, null, stype);
                sdetail.setExtended(true);
View Full Code Here

Examples of org.jibx.util.IClass

            if (isChoice()) {
                vctx.addWarning("'choice' attribute ignored on collection");
            }
           
            // get the actual collection type and item type
            IClass clas = getType();
            if (clas == null) {
                clas = vctx.getContextObject().getObjectType();
            }
            String tname = m_itemTypeName;
            if (tname == null) {
                String ctype = clas.getName();
                if (ctype.endsWith("[]")) {
                    tname = ctype.substring(0, ctype.length()-2);
                } else {
                    tname = "java.lang.Object";
                }
            }
            m_itemTypeClass = vctx.getClassInfo(tname);
            if (m_itemTypeClass == null) {
                vctx.addFatal("Can't find class " + tname);
            }
           
            // handle input and output bindings separately
            if (vctx.isInBinding()) {
               
                // check store techniques
                String sname = m_storeMethodName;
                String aname = m_addMethodName;
                if (sname != null && aname != null) {
                    vctx.addWarning("Both store-method and add-method supplied; using add-method");
                    sname = null;
                }
                if (vctx.isLookupSupported()) {
                   
                    // set defaults based on collection type if needed
                    if (sname == null && aname == null) {
                        if (clas.isSuperclass("java.util.ArrayList") ||
                            clas.isSuperclass("java.util.Vector") ||
                            clas.isImplements("Ljava/util/Collection;")) {
                            aname = "add";
                        } else if (!clas.getName().endsWith("[]")) {
                            vctx.addError("Need store-method or add-method for input binding");
                        }
                    }
                   
                    // find the actual method information
                    if (sname != null) {
                        m_storeMethodItem = clas.getBestMethod(sname,
                            null, new String[] { "int", tname });
                        if (m_storeMethodItem == null) {
                            vctx.addError("store-method " + sname +
                                " not found in class " + clas.getName());
                        }
                    }
                    if (aname != null) {
                        m_addMethodItem = clas.getBestMethod(aname,
                            null, new String[] { tname });
                        if (m_addMethodItem == null) {
                            vctx.addError("add-method " + aname +
                                " not found in class " + clas.getName());
                        }
                    }
                }
               
            }
            if (vctx.isOutBinding()) {
               
                // precheck load techniques
                String lname = m_loadMethodName;
                String sname = m_sizeMethodName;
                String iname = m_iterMethodName;
                if (lname == null) {
                    if (sname != null) {
                        vctx.addWarning("size-method requires load-method; ignoring supplied size-method");
                        sname = null;
                    }
                } else {
                    if (sname == null) {
                        vctx.addWarning("load-method requires size-method; ignoring supplied load-method");
                        lname = null;
                    } else {
                        if (iname != null) {
                            vctx.addWarning("Both load-method and  iter-method supplied; using load-method");
                            iname = null;
                        }
                    }
                }
                if (vctx.isLookupSupported()) {
                   
                    // set defaults based on collection type if needed
                    if (lname == null && iname == null) {
                        if (clas.isSuperclass("java.util.ArrayList") ||
                            clas.isSuperclass("java.util.Vector")) {
                            lname = "get";
                            sname = "size";
                        } else if (clas.isImplements("Ljava/util/Collection;")) {
                            iname = "iterator";
                        }
                    }
                   
                    // postcheck load techniques with defaults set
                    if (lname == null) {
                        if (iname == null && !clas.getName().endsWith("[]")) {
                            vctx.addError("Need load-method and size-method, or iter-method, for output binding");
                        }
                    } else {
                        if (sname == null && iname == null) {
                            vctx.addError("Need load-method and size-method, or iter-method, for output binding");
                        }
                    }
                   
                    // find the actual method information
                    if (lname != null) {
                        m_loadMethodItem = clas.getBestMethod(lname,
                            tname, new String[] { "int" });
                        if (m_loadMethodItem == null) {
                            vctx.addError("load-method " + lname +
                                " not found in class " + clas.getName());
                        }
                    }
                    if (iname != null) {
                        m_iterMethodItem = clas.getBestMethod(iname,
                            "java.util.Iterator", new String[0]);
                        if (m_iterMethodItem == null) {
                            vctx.addError("iter-method " + iname +
                                " not found in class " + clas.getName());
                        }
                    }
                }
            }
        }
View Full Code Here

Examples of org.jibx.util.IClass

                        comp instanceof ValueElement) {
                        vctx.addFatal("<value> elements within a collection must define element name for unmarshalling", comp);
                    }
                   
                    // find the type associated with this component (if any)
                    IClass ctype = comp.getType();
                    expand = false;
                    if (comp instanceof ContainerElementBase) {
                        ContainerElementBase contain = (ContainerElementBase)comp;
                        if (contain.hasObject()) {
                            ctype = contain.getObjectType();
                        } else {
                            expand = true;
                        }
                    }
                   
                    // see if a type was found (no need to look at children)
                    if (!expand) {
                       
                        // verify that type is compatible with collection
                        if (!ctype.isAssignable(type)) {
                            vctx.addFatal("References to collection items must use compatible types: " +
                                ctype.getName() + " cannot be used as " +
                                type.getName(), child);
                        }
                    }
                }
               
View Full Code Here

Examples of org.jibx.util.IClass

                        }
                    }
                    if (vctx.isOutBinding()) {
                       
                        // make sure types differ or test method supplied
                        IClass type = comp.getType();
                        if (type.isAssignable(prior.getType())) {
                            IClassItem test = null;
                            if (prior instanceof ValueElement) {
                                test = ((ValueElement)prior).getTest();
                            } else if (prior instanceof StructureElementBase) {
                                test = ((StructureElementBase)prior).getTest();
View Full Code Here

Examples of org.testng.IClass

   */
  protected IClass findOrCreateIClass(Class cls, Object instance,
      XmlTest xmlTest,
      IAnnotationFinder annotationFinder)
  {
    IClass result = m_classes.get(cls);
    if (null == result) {
      result = new ClassImpl(cls, instance, m_classes, xmlTest, annotationFinder);
      m_classes.put(cls, result);
    }

View Full Code Here

Examples of org.testng.IClass

//    }
   
    Collection<Class> allClasses = invokeSuite(classes);
   
    for (Class cls : allClasses) {
      IClass ic = findOrCreateIClass(cls, null, xmlTest, finder);
      Utils.log("JUnitClassFinder", 3, "Looking up ClassFinder for " + cls + " " + cls.hashCode() + " " + finder.hashCode());
      if (null != ic) {
        putIClass(cls, ic);
      }
    }
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.