Package org.apache.cxf.aegis.type

Examples of org.apache.cxf.aegis.type.Type


        return prefix + ":" + localName;
    }

    private Type getType(BeanTypeInfo inf, QName name) {
        Type type = inf.getType(name);

        if (type == null) {
            throw new NullPointerException("Couldn't find type for" + name + " in class "
                                           + getTypeClass().getName());
        }
View Full Code Here


        /*
         * Automagically add chain of superclasses *if* this is an an extension.
         */
        if (inf.isExtension()) {
            Type sooperType = getSuperType();
            if (sooperType != null) {
                deps.add(sooperType);
            }
        }

View Full Code Here

    }

    protected BeanTypeInfo getBeanTypeInfoWithProperty(QName name) {
        // search the BeanType superType tree for the first BeanType with a property named 'name'
        BeanType beanType = this;
        Type type = null;
        while (type == null && beanType != null) {
            type = beanType.getTypeInfo().getType(name);

            if (type == null) {
                Type superType = beanType.getSuperType(); /* The class might inherit from, say, 'Integer'.
                                                             In which case we've got no BeanType
                                                             to work with. */
                if (superType instanceof BeanType) {
                    beanType = (BeanType) superType;
                } else {
View Full Code Here

        /*
         * Don't dig any deeper than Object or Exception
         */
        if (c != null && c != Object.class && c != Exception.class && c != RuntimeException.class) {
            TypeMapping tm = inf.getTypeMapping();
            Type superType = tm.getType(c);
            if (superType == null) {
                // if we call createType, we know that we'll get a BeanType. */
                superType = (BeanType)getTypeMapping().getTypeCreator().createType(c);
                Class cParent = c.getSuperclass();
                if (cParent != null && cParent != Object.class) {
View Full Code Here

        Iterator elements = info.getElements();
        assertTrue(elements.hasNext());
        QName element = (QName)elements.next();
        assertTrue(elements.hasNext());

        Type custom = info.getType(element);

        if ("bogusProperty".equals(element.getLocalPart())) {
            assertTrue(custom instanceof StringType);
        } else if ("elementProperty".equals(element.getLocalPart())) {
            assertTrue(custom instanceof CustomStringType);
View Full Code Here

            String explicitTypeName = DOMUtils.getAttributeValueEmptyNull(e, "type");
            if (explicitTypeName != null) {
                try {
                    Class<?> typeClass =
                        ClassLoaderUtils.loadClass(explicitTypeName, XMLBeanTypeInfo.class);
                    Type customTypeObject = (Type) typeClass.newInstance();
                    mapType(mappedName, customTypeObject);
                    QName schemaType = mappedType;
                    if (schemaType == null) {
                        schemaType = getTypeMapping().getTypeQName(pd.getPropertyType());
                    }
                    customTypeObject.setTypeClass(typeClass);
                    customTypeObject.setSchemaType(schemaType);
                } catch (ClassNotFoundException e1) {
                    //
                } catch (InstantiationException e2) {
                    //
                } catch (IllegalAccessException e3) {
View Full Code Here

        // TODO Auto-generated method stub

    }

    public void write(Object obj, MessagePartInfo part, XMLStreamWriter output) {
        Type type = databinding.getType(part);

        if (type == null) {
            throw new Fault(new Message("NO_MESSAGE_FOR_PART", LOG));
        }


        Map<String, Object> props = (Endpoint)getProperty(ENDPOINT);
        if (props == null) {
            props = new HashMap<String, Object>();
        }
        Context context = new Context(props);
       
        // I'm not sure that this is the right type mapping
        context.setTypeMapping(type.getTypeMapping());
        context.setOverrideTypes(CastUtils.cast(databinding.getOverrideTypes(), String.class));
        context.setAttachments(attachments);
        Object val = databinding.getService().get(AegisDatabinding.WRITE_XSI_TYPE_KEY);
        if ("true".equals(val) || Boolean.TRUE.equals(val)) {
            context.setWriteXsiTypes(true);
        }
       
        type = TypeUtil.getWriteType(context, obj, type);
       
        try {
            if (obj == null) {
                if (part.getXmlSchema() instanceof XmlSchemaElement
                    && ((XmlSchemaElement)part.getXmlSchema()).getMinOccurs() == 0) {
                    //skip writing minOccurs=0 stuff if obj is null
                    return;
                } else if (type.isNillable() && type.isWriteOuter()) {
                    ElementWriter writer = new ElementWriter(output);
                    MessageWriter w2 = writer.getElementWriter(part.getConcreteName());
                    w2.writeXsiNil();
                    w2.close();
                    return;
                }
            }
            ElementWriter writer = new ElementWriter(output);
            MessageWriter w2 = writer.getElementWriter(part.getConcreteName());
            type.writeObject(obj, w2, context);
            w2.close();
        } catch (DatabindingException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

                    c = ClassLoaderUtils.loadClass(typeName, TypeUtil.class);
                } catch (ClassNotFoundException e) {
                    throw new DatabindingException("Could not find override type class: " + typeName, e);
                }

                Type t = tm.getType(c);
                if (t == null) {
                    t = tm.getTypeCreator().createType(c);
                    tm.register(t);
                }
                if (t instanceof BeanType) {
View Full Code Here

                                     AbstractMessageContainer container,
                                     int partType, Set<Type> deps) {
        for (Iterator itr = container.getMessageParts().iterator(); itr.hasNext();) {
            MessagePartInfo part = (MessagePartInfo)itr.next();

            Type type = getParameterType(s, serviceTM, part, partType);

            if (part.getXmlSchema() == null) {
                //schema hasn't been filled in yet
                if (type.isAbstract()) {
                    part.setTypeQName(type.getSchemaType());
                } else {
                    part.setElementQName(type.getSchemaType());
                }
            }

            part2Type.put(part, type);
View Full Code Here

        QName name = tm.getTypeCreator().getElementName(m, param);

        // No mapped name was specified, so if its a complex type use that name
        // instead
        if (name == null) {
            Type type = tm.getTypeCreator().createType(m, param);

            if (type.isComplex() && !type.isAbstract()) {
                name = type.getSchemaType();
            }
        }

        return name;
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.aegis.type.Type

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.