Package org.apache.cxf.aegis.type

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


        BeanType type = new BeanType();
        type.setTypeClass(SerializableBean.class);
        type.setTypeMapping(mapping);
        type.setSchemaType(new QName("urn:foo", "SerializableBean"));

        AegisType stringType = mapping.getType(String.class);
        assertTrue(type.getDependencies().contains(stringType));

        type = new BeanType();
        type.setTypeClass(CloneableBean.class);
        type.setTypeMapping(mapping);
View Full Code Here


                if (childReader.isXsiNil()) {
                    childReader.readToEnd();
                    continue;
                }
                QName name = childReader.getName();
                AegisType defaultType = inf.getType(name);
                AegisType type = TypeUtil.getReadType(childReader.getXMLStreamReader(),
                                                 context.getGlobalContext(), defaultType);
                if (type != null) {
                    String value = (String)type.readObject(childReader, context);
                    if ("key".equals(name.getLocalPart())) {
                        key = value;
                    }
                } else {
                    childReader.readToEnd();
View Full Code Here

    }

    @Override
    public Set<AegisType> getDependencies() {
        // The string type is provided by aegis, so it should always be there.
        AegisType stringType = getTypeMapping().getType(String.class);
        return Collections.singleton(stringType);
    }
View Full Code Here

        String typename = arrayOfNameElement.getAttribute("type");
        String prefix = typename.split(":")[0];

        String uri = getNamespaceForPrefix(rootElement, arrayOfNameElement, prefix);
        assertNotNull(uri);
        AegisType nameType = tm.getTypeCreator().createType(Name.class);
        QName tmQname = nameType.getSchemaType();
        assertEquals(tmQname.getNamespaceURI(), uri);
       
    }
View Full Code Here

    }

    public <T> T readWriteReadRef(String file, Class<T> typeClass) throws XMLStreamException {
        Context context = getContext();
       
        AegisType type = mapping.getType(typeClass);
        assertNotNull("no type found for " + typeClass.getName());

        // read file
        ElementReader reader = new ElementReader(getClass().getResourceAsStream(file));
        T value = typeClass.cast(type.readObject(reader, context));
        reader.getXMLStreamReader().close();

        // write value to element
        Element element = writeRef(value);
View Full Code Here

    public Object readRef(ElementReader root) throws XMLStreamException {
        Context context = getContext();

        // get AegisType based on the element qname
        MessageReader reader = root.getNextElementReader();
        AegisType type = this.mapping.getType(reader.getName());
        assertNotNull("type is null", type);

        // read ref
        SoapRefType soapRefType = new SoapRefType(type);
        SoapRef ref = (SoapRef) soapRefType.readObject(reader, context);
View Full Code Here

        // return the ref
        return ref.get();
    }

    public Element writeRef(Object instance) {
        AegisType type = mapping.getType(instance.getClass());
        assertNotNull("no type found for " + instance.getClass().getName());

        // create the document
        Element element = createElement("urn:Bean", "root", "b");
        MapNamespaceContext namespaces = new MapNamespaceContext();
View Full Code Here

        return element;
    }

    public void verifyInvalid(String resourceName, Class<?> expectedType) throws XMLStreamException {
        AegisType type = mapping.getType(expectedType);
        assertNotNull("type is null", type);

        Context context = getContext();

        ElementReader reader = new ElementReader(getClass().getResourceAsStream(resourceName));
        try {
            type.readObject(reader, context);
            fail("expected DatabindingException");
        } catch (DatabindingException expected) {
            // expected
        } finally {
            reader.getXMLStreamReader().close();
View Full Code Here

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

        AegisType 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

    private SoapArrayType createArrayType(Class<?> typeClass) {
        return createArrayType(typeClass, new QName("urn:Bean", "stuff"));
    }

    private SoapArrayType createArrayType(Class<?> typeClass, QName schemaType) {
        AegisType type = mapping.getType(typeClass);
        if (type != null) {
            return (SoapArrayType) type;
        }
        SoapArrayType arrayType = new SoapArrayType();
        arrayType.setTypeClass(typeClass);
View Full Code Here

TOP

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

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.