Package org.apache.cxf.aegis.type

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


            nilWriter.close();
        } else {
            Type type = determineType(context, object.getClass());

            if (null == type) {
                TypeMapping tm = context.getTypeMapping();
                if (tm == null) {
                    tm = getTypeMapping();
                }

                type = tm.getTypeCreator().createType(object.getClass());
                tm.register(type);
            }
           
            writer.writeXsiType(type.getSchemaType());
            boolean nextIsBeanType = type instanceof BeanType;
            if (nextIsBeanType) {
View Full Code Here


            }
        }
    }

    private Type determineType(Context context, Class clazz) {
        TypeMapping tm = context.getTypeMapping();
        if (tm == null) {
            tm = getTypeMapping();
        }
        Type type = tm.getType(clazz);

        if (null != type) {
            return type;
        }

        Class[] interfaces = clazz.getInterfaces();

        for (int i = 0; i < interfaces.length; i++) {
            Class anInterface = interfaces[i];

            type = tm.getType(anInterface);

            if (null != type) {
                return type;
            }
        }
View Full Code Here

        addNamespace("xsi", SOAPConstants.XSI_NS);
        addNamespace("soapenc", Soap11.getInstance().getSoapEncodingStyle());

        AegisContext context = new AegisContext();
        // create a different mapping than the context creates.
        TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false);
        mapping = new DefaultTypeMapping(SOAPConstants.XSD, baseMapping);
        mapping.setTypeCreator(context.createTypeCreator());
        context.setTypeMapping(mapping);
        context.initialize();
        // serialization root type
View Full Code Here

   
    @Test
    public void testAnnotatedDefaultUnqualifiedAttribute() throws Exception {
        AegisContext context = new AegisContext();
        context.initialize();
        TypeMapping mapping = context.getTypeMapping();
       
        Type type = mapping.getTypeCreator().createType(AttributeBean.class);
        type.setSchemaType(new QName("urn:Bean", "bean"));

        Context messageContext = new Context(context);
        AttributeBean bean = new AttributeBean();
        Element element = writeObjectToElement(type, bean, messageContext);
View Full Code Here

        TypeCreationOptions typeCreationOptions =
            new TypeCreationOptions();
        typeCreationOptions.setQualifyAttributes(true);
        context.setTypeCreationOptions(typeCreationOptions);
        context.initialize();
        TypeMapping mapping = context.getTypeMapping();
       
        Type type = mapping.getTypeCreator().createType(AttributeBean.class);
        type.setSchemaType(new QName("urn:Bean", "bean"));

        Context messageContext = new Context(context);
        AttributeBean bean = new AttributeBean();
        Element element = writeObjectToElement(type, bean, messageContext);
View Full Code Here

    }
    @Test
    public void testXmlDefaultUnqualifiedAttribute() throws Exception {
        AegisContext context = new AegisContext();
        context.initialize();
        TypeMapping mapping = context.getTypeMapping();
       
        Type type = mapping.getTypeCreator().createType(XmlMappedAttributeBean.class);
        type.setSchemaType(new QName("urn:Bean", "bean"));

        Context messageContext = new Context(context);
        XmlMappedAttributeBean bean = new XmlMappedAttributeBean();
       
View Full Code Here

        TypeCreationOptions typeCreationOptions =
            new TypeCreationOptions();
        typeCreationOptions.setQualifyAttributes(true);
        context.setTypeCreationOptions(typeCreationOptions);
        context.initialize();
        TypeMapping mapping = context.getTypeMapping();
       
        Type type = mapping.getTypeCreator().createType(XmlMappedAttributeBean.class);
        type.setSchemaType(new QName("urn:Bean", "bean"));

        Context messageContext = new Context(context);
        XmlMappedAttributeBean bean = new XmlMappedAttributeBean();
View Full Code Here

            typeQName = extractQName(reader, typeName);
        } else {
            typeQName = reader.getName();
        }

        TypeMapping tm = context.getTypeMapping();
        if (tm == null) {
            tm = getTypeMapping();
        }

        type = tm.getType(typeQName);

        if (type == null) {
            type = tm.getType(getSchemaType());
        }

        if (type == this) {
            throw new DatabindingException("Could not determine how to read type: " + typeQName);
        }
View Full Code Here

            nilWriter.close();
        } else {
            AegisType type = determineType(context, object.getClass());

            if (null == type) {
                TypeMapping tm = context.getTypeMapping();
                if (tm == null) {
                    tm = getTypeMapping();
                }

                type = tm.getTypeCreator().createType(object.getClass());
                tm.register(type);
            }

            writer.writeXsiType(type.getSchemaType());
            boolean nextIsBeanType = type instanceof BeanType;
            if (nextIsBeanType) {
View Full Code Here

            }
        }
    }

    public AegisType determineType(Context context, Class<?> clazz) {
        TypeMapping tm = context.getTypeMapping();
        if (tm == null) {
            tm = getTypeMapping();
        }
        AegisType type = tm.getType(clazz);

        if (null != type) {
            return type;
        }

        Class<?>[] interfaces = clazz.getInterfaces();

        for (int i = 0; i < interfaces.length; i++) {
            Class<?> anInterface = interfaces[i];

            type = tm.getType(anInterface);

            if (null != type) {
                return type;
            }
        }
View Full Code Here

TOP

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

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.