Examples of XMLBeanInfo


Examples of org.apache.commons.betwixt.XMLBeanInfo

     */
    private void register(Class beanClass, String path) throws IntrospectionException {
        if ( log.isTraceEnabled() ) {
            log.trace( "Registering class " + beanClass );
        }
        XMLBeanInfo xmlInfo = introspector.introspect( beanClass );
        registeredClasses.add( beanClass );

        ElementDescriptor elementDescriptor = xmlInfo.getElementDescriptor();       

        if (path == null) {
            path = elementDescriptor.getQualifiedName();
        }
       
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

     * @throws SAXException if the primitiveTypes attribute contains an invalid value
     */
    public void begin(String name, String namespace, Attributes attributes) throws SAXException {
        Class beanClass = getBeanClass();
       
        xmlBeanInfo = new XMLBeanInfo( beanClass );
       
        String value = attributes.getValue( "primitiveTypes" );
        if ( value != null ) {
            if ( value.equalsIgnoreCase( "element" ) ) {
                getXMLInfoDigester().setAttributesForPrimitives( false );
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

    protected void addDescriptor( Descriptor nodeDescriptor ) throws SAXException {
        Object top = digester.peek();
        if ( top instanceof XMLBeanInfo ) {
            log.warn( "It is advisable to put an <addDefaults/> element inside an <element> tag" );
           
            XMLBeanInfo beanInfo = (XMLBeanInfo) top;
            // if there is already a root element descriptor then use it
            // otherwise use this descriptor
            if ( nodeDescriptor instanceof ElementDescriptor ) {
                ElementDescriptor elementDescriptor = (ElementDescriptor) nodeDescriptor;
                ElementDescriptor root = beanInfo.getElementDescriptor() ;
                if ( root == null ) {
                    beanInfo.setElementDescriptor( elementDescriptor );
                } else {
                    root.addElementDescriptor( elementDescriptor );
                }
            } else {
                throw new SAXException(
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

     * Otherwise null.
     */
    protected ElementDescriptor getRootElementDescriptor() {
        Object top = digester.peek();
        if ( top instanceof XMLBeanInfo ) {
            XMLBeanInfo beanInfo = (XMLBeanInfo) top;
            return beanInfo.getElementDescriptor();
           
        } else if ( top instanceof ElementDescriptor ) {
            ElementDescriptor parent = (ElementDescriptor) top;
            // XXX: could maybe walk up the parent hierarchy?
            return parent;
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

    // special case to ensure that root class is appropriately marked
    //TODO: is this really necessary?
        ElementDescriptor nextDescriptor = null;
    if (elementMappingStack.size() == 1 && rootClass != null) {
      markClassMap(rootClass);
            XMLBeanInfo rootClassInfo
                = getXMLIntrospector().introspect(rootClass);
            nextDescriptor = rootClassInfo.getElementDescriptor();
    } else {
            ElementDescriptor currentDescriptor = getCurrentDescriptor();
            if (currentDescriptor != null) {
                nextDescriptor = currentDescriptor.getElementDescriptor(elementName);
            }
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

        if (mappedClazz.isArray()) {
            mappedClazz = mappedClazz.getComponentType();
        }
    elementMappingStack.push(mappedClazz);
       
        XMLBeanInfo mappedClassInfo = getXMLIntrospector().introspect(mappedClazz);
        ElementDescriptor mappedElementDescriptor = mappedClassInfo.getElementDescriptor();
        descriptorStack.push(mappedElementDescriptor);
       
        Updater updater = mappedElementDescriptor.getUpdater();
        updaterStack.push(updater);
  }
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

        Class mappedType = mappedDescriptor.getSingularPropertyType();
        if (mappedType == null) {
            mappedType = mappedDescriptor.getPropertyType();
        }
        for (Iterator it = cachedClasses.iterator(); it.hasNext();) {
            XMLBeanInfo  beanInfo  = get((Class)it.next());
            ElementDescriptor typeDescriptor = beanInfo.getElementDescriptor();
            boolean sameName = mapping.getName().equals(typeDescriptor.getQualifiedName());
            if (sameName)
            {
               
                boolean compatibleClass = mappedType.isAssignableFrom(beanInfo.getBeanClass());
                if (compatibleClass ) {
                    result = beanInfo.getBeanClass();
                    break;
                }
            }
        }
        return result;
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

            }
        }

        Object top = digester.peek();
        if (top instanceof XMLBeanInfo) {
            XMLBeanInfo beanInfo = (XMLBeanInfo) top;
            beanInfo.setElementDescriptor(descriptor);
            beanClass = beanInfo.getBeanClass();
            descriptor.setPropertyType(beanClass);

        } else if (top instanceof ElementDescriptor) {
            ElementDescriptor parent = (ElementDescriptor) top;
            parent.addElementDescriptor(descriptor);
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

            }
        }
       
        Object top = digester.peek();
        if ( top instanceof XMLBeanInfo ) {
            XMLBeanInfo beanInfo = (XMLBeanInfo) top;
            ElementDescriptor elementDescriptor = beanInfo.getElementDescriptor();
            if (elementDescriptor != null) {
                elementDescriptor.addContentDescriptor( descriptor );
            }
           
        } else if ( top instanceof ElementDescriptor ) {
View Full Code Here

Examples of org.apache.commons.betwixt.XMLBeanInfo

        }
       
        try {
           
            Class beanClass = Class.forName(className);
            XMLBeanInfo xmlBeanInfo = new XMLBeanInfo(beanClass);
            XMLBeanInfoDigester xmlBeanInfoDigester = (XMLBeanInfoDigester) getDigester();
            xmlBeanInfoDigester.setBeanClass(beanClass);
            xmlBeanInfoDigester.push(xmlBeanInfo);
           
        } catch (ClassNotFoundException e) {
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.