Package org.codehaus.xfire.aegis.type

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


        type.setTypeClass(Date.class);
        type.setSchemaType(new QName(ns, "date"));

        mapping.register(type);
       
        Type tsType = mapping.getType(Timestamp.class);
        assertTrue(tsType instanceof TimestampType);
       
        Type dtoType = mapping.getTypeCreator().createType(DateDTO.class);
        mapping.register(dtoType);
       
        // Test reading
        ElementReader reader = new ElementReader(getResourceAsStream("/org/codehaus/xfire/aegis/type/basic/dates.xml"));
       
        Object obj = dtoType.readObject(reader, new MessageContext());
        DateDTO dto = (DateDTO) obj;
        assertNotNull(dto.getDate0());
        assertNotNull(dto.getDateTime0());
        assertNotNull(dto.getDateTime1());
        assertNotNull(dto.getDateTime2());
        assertNotNull(dto.getDateTime3());
        assertNotNull(dto.getDateTime4());
       
        assertTrue ( dto.getDateTime3().before( dto.getDateTime4() ) );
       
        assertNotNull(dto.getDateTime5());
        assertNotNull(dto.getDateTime6());
       
        assertTrue ( dto.getDateTime5().before( dto.getDateTime6() ) );
       
        assertNotNull(dto.getTime0());
        assertNotNull(dto.getTime1());
       
        Element element = new Element("dates", ns);
        new Document(element);
        JDOMWriter writer = new JDOMWriter(element);
        MessageContext mc = new MessageContext();
        mc.setService(new Service(new ServiceInfo(
            new QName("larry","curly","moe"),DateTypeTest.class)));
        dtoType.writeObject(dto, writer, new MessageContext());
        writer.close();
       
        addNamespace("d", ns);
        assertValid("/d:dates/d:date0", element);
        assertValid("/d:dates/d:dateTime0", element);
View Full Code Here


        assertTrue(elements.hasNext());
       
        element = (QName) elements.next();
        assertFalse(elements.hasNext());
       
        Type custom = info.getType(element);

        assertTrue(custom instanceof CustomStringType);
       
        Iterator atts = info.getAttributes();
        assertTrue(atts.hasNext());
View Full Code Here

        try
        {
            String ns = configuration.getAttribute("namespace", tm.getEncodingStyleURI());
            String name = configuration.getAttribute("name");

            Type type = (Type) loadClass(configuration.getAttribute("type")).newInstance();

            tm.register(loadClass(configuration.getAttribute("class")),
                        new QName(ns, name),
                        type);
        }
View Full Code Here

            QName qname = new QName(ns, name);

            Class clazz = ClassLoaderUtils.loadClass( configuration.getAttribute("class"), getClass() );
            Class typeClass = ClassLoaderUtils.loadClass( configuration.getAttribute("type"), getClass() );

            Type type = (Type) typeClass.newInstance();

            tm.register(clazz, qname, type);

            logger.debug( "Registered " + typeClass.getName() +
                              " for " + qname + " with class " + clazz.getName() );
View Full Code Here

            return context.getCodeModel().ref(xst.getJavaClass());
        }
        else
        {
            Class cls;
            Type type = tm.getType(schemaType);
            cls = (type != null) ? cls = type.getTypeClass() : XmlObject.class;
           
            return context.getCodeModel().ref(cls);
        }
    }
View Full Code Here

                catch (ClassNotFoundException e)
                {
                    throw new XFireRuntimeException("Could not find override type class: " + typeName, e);
                }
               
                Type t = tm.getType(c);
                if (t == null)
                {
                    t = tm.getTypeCreator().createType(c);
                    tm.register(t);
                }
View Full Code Here

    }

    public Object readParameter(MessagePartInfo p, XMLStreamReader xsr, MessageContext context)
        throws XFireFault
    {
        Type type = getTypeMapping(context.getService()).getType(xsr.getName());

        if (type == null)
            type = (Type) p.getSchemaType();
       
        type = getReadType(xsr, context, type);

        MessageReader reader = new ElementReader(xsr);

        if (reader.isXsiNil())
        {
            reader.readToEnd();
            return null;
        }

        context.setProperty(CURRENT_MESSAGE_PART, p);
        return type.readObject(reader, context);
    }
View Full Code Here

        {
            QName overrideTypeName = NamespaceHelper.createQName(xsr.getNamespaceContext(),
                                                                 overrideType);
            if (!overrideTypeName.equals(type.getSchemaType()))
            {
                Type type2 = type.getTypeMapping().getType(overrideTypeName);
                if (type2 == null)
                {
                    LOG.info("xsi:type=\"" + overrideTypeName
                             + "\" was specified, but no corresponding Type was registered; defaulting to "
                             + type.getSchemaType());
View Full Code Here

                               XMLStreamWriter writer,
                               MessageContext context,
                               Object value)
        throws XFireFault
    {
        Type type = (Type) p.getSchemaType();

        type = getWriteType(context, value, type);
        MessageWriter mw = new ElementWriter(writer);

        if (type.isNillable() && type.isWriteOuter() && value == null)
        {
            mw.writeXsiNil();
            return;
        }

        context.setProperty(CURRENT_MESSAGE_PART, p);
        type.writeObject(value, mw, context);
    }
View Full Code Here

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

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

        return name;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.xfire.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.