Examples of TypeMappingRegistry


Examples of org.apache.axis.encoding.TypeMappingRegistry

        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
        context.setDoMultiRefs(false)// no multirefs
        context.setPretty(false);

        // Create a TypeMapping and register the Bean serializer/deserializer
        TypeMappingRegistry reg = context.getTypeMappingRegistry();
        TypeMapping tm = (TypeMapping) reg.createTypeMapping();
        // The "" namespace is literal (no encoding).
        tm.setSupportedNamespaces(new String[] {Constants.URI_CURRENT_SOAP_ENC});
        reg.register(Constants.URI_CURRENT_SOAP_ENC, tm);

        QName beanQName = new QName("typeNS", "TheBean");
        tm.register(AttributeBean.class,
                    beanQName,
                    new BeanSerializerFactory(AttributeBean.class, beanQName),
View Full Code Here

Examples of org.apache.axis2.databinding.typemapping.TypeMappingRegistry

        return desc;
    }

    private static void fillInTypeDesc(TypeDesc desc, Class beanClass)
            throws Exception {
        TypeMappingRegistry tmr = new TypeMappingRegistry();

        desc.setJavaClass(beanClass);

        BeanInfo beanInfo = Introspector.getBeanInfo(beanClass);
        PropertyDescriptor [] propDescs = beanInfo.getPropertyDescriptors();
        for (int i = 0; i < propDescs.length; i++) {
            PropertyDescriptor propDesc = propDescs[i];
            String name = propDesc.getName();

            if (name.equals("class"))
                continue;

            BeanPropertyDescriptor beanDesc = new BeanPropertyDescriptor();
            beanDesc.setReadMethod(propDesc.getReadMethod());
            beanDesc.setWriteMethod(propDesc.getWriteMethod());

            ElementDesc elDesc = desc.getElementDesc(name);
            boolean addDesc = true// Should we add this (new) element?
            if (elDesc == null) {
                elDesc = new ElementDesc();
                elDesc.setFieldName(name);
            } else {
                addDesc = false; // Already present, so don't add it again
            }
            Class type;
            boolean isCollection = false;
            if (propDesc instanceof IndexedPropertyDescriptor) {
                IndexedPropertyDescriptor iProp =
                        (IndexedPropertyDescriptor)propDesc;
                beanDesc.setIndexedReadMethod(iProp.getIndexedReadMethod());
                beanDesc.setIndexedWriteMethod(iProp.getIndexedWriteMethod());
                type = iProp.getIndexedPropertyType();
                elDesc.setIndexedAccessor(beanDesc);
                isCollection = true;
            } else {
                type = propDesc.getPropertyType();
                // TODO : check if this is a supported collection type
            }

            if (isCollection && elDesc.getMaxOccurs() == 0)
                elDesc.setMaxOccurs(-1);

            elDesc.setAccessor(beanDesc);

            if (elDesc.getQName() == null) {
                elDesc.setQName(new QName(name));
            }

            if (elDesc.getDeserializerFactory() == null) {
                DeserializerFactory dser = tmr.getDeserializerFactory(type);
                elDesc.setDeserializerFactory(dser);
            }

            if (elDesc.getRawSerializer() == null) {
                Serializer ser = tmr.getSerializer(type);
                elDesc.setSerializer(ser);
            }

            if (addDesc)
                desc.addField(elDesc);
View Full Code Here

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

    TypeMapping mapping;

    public void setUp() throws Exception {
        super.setUp();

        TypeMappingRegistry reg = new DefaultTypeMappingRegistry(true);
        mapping = reg.createTypeMapping(true);
    }
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.TypeMappingRegistry

       
        addNamespace("t", "urn:test");
        addNamespace("xsd", SoapConstants.XSD);
        addNamespace("xsi", SoapConstants.XSI_NS);
       
        TypeMappingRegistry reg = new DefaultTypeMappingRegistry(true);
        mapping = reg.createTypeMapping(true);
    }
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.TypeMappingRegistry

       
        addNamespace("t", "urn:test");
        addNamespace("xsd", SoapConstants.XSD);
        addNamespace("xsi", SoapConstants.XSI_NS);
       
        TypeMappingRegistry reg = new DefaultTypeMappingRegistry(true);
        mapping = reg.createTypeMapping(true);
        mapping.setEncodingStyleURI("urn:test");
    }
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.TypeMappingRegistry

    {
        // XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        // XMLStreamWriter writer = ofactory.createXMLStreamWriter(bos);
        XMLStreamWriter writer = STAXUtils.createXMLStreamWriter(bos, null, null);
        TypeMappingRegistry tmr = new DefaultTypeMappingRegistry(true);
        TypeMapping tm = tmr.createTypeMapping(true);

        SimpleBean bean = new SimpleBean();
        bean.setBleh("bleh");
        bean.setHowdy("howdy");
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.TypeMappingRegistry

    {
        // XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        // XMLStreamWriter writer = ofactory.createXMLStreamWriter(bos);
        XMLStreamWriter writer = STAXUtils.createXMLStreamWriter(bos, null, null);
        TypeMappingRegistry tmr = new DefaultTypeMappingRegistry(true);
        TypeMapping tm = tmr.createTypeMapping(true);

        registerSimpleBeanType(tm);
        registerArrayType(tm);

        SimpleBean bean = new SimpleBean();
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.TypeMappingRegistry

       
        addNamespace("t", "urn:test");
        addNamespace("xsd", SoapConstants.XSD);
        addNamespace("xsi", SoapConstants.XSI_NS);
       
        TypeMappingRegistry reg = new DefaultTypeMappingRegistry(true);
        mapping = reg.createTypeMapping(true);
    }
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.TypeMappingRegistry

    public void setUp()
        throws Exception
    {
        super.setUp();

        TypeMappingRegistry reg = new DefaultTypeMappingRegistry(true);
        mapping = reg.createTypeMapping(true);
    }
View Full Code Here

Examples of org.codehaus.xfire.aegis.type.TypeMappingRegistry

       
        addNamespace("t", "urn:test");
        addNamespace("xsd", SoapConstants.XSD);
        addNamespace("xsi", SoapConstants.XSI_NS);
       
        TypeMappingRegistry reg = new DefaultTypeMappingRegistry(true);
        mapping = reg.createTypeMapping(true);
    }
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.