Package org.apache.tuscany.spi.idl

Examples of org.apache.tuscany.spi.idl.TypeInfo


    }

    public T transform(Object source, TransformationContext context) {
        ElementInfo element =
                (ElementInfo) context.getTargetDataType().getMetadata(ElementInfo.class.getName());
        TypeInfo simpleType = (TypeInfo) element.getType();
        String text = mapper.toXMLLiteral(simpleType, source, context);
        return createElement(element, text, context);
    }
View Full Code Here


        property.setOverride(OverrideOptions.valueOf(annotation.override().toUpperCase()));
        String xmlType = annotation.xmlType();
        if (xmlType != null && xmlType.length() != 0) {
            property.setXmlType(QName.valueOf(annotation.xmlType()));
        } else {
            TypeInfo type = typeMapper.getXMLType(property.getJavaType());
            if (type != null) {
                property.setXmlType(type.getQName());
            }
        }
    }
View Full Code Here

            throw new IllegalArgumentException(e);
        }
    }

    public Class getJavaType(TypeInfo xmlType) {
        TypeInfo baseType = xmlType;
        while (baseType.getBaseType() != null) {
            baseType = baseType.getBaseType();
        }
        return XML2JAVA.get(baseType.getQName().getLocalPart());
    }
View Full Code Here

        }
        String value = literal.trim();
        if (!simpleType.isSimpleType()) {
            throw new IllegalArgumentException("Complex type is not supported for simple java databinding.");
        }
        TypeInfo baseType = simpleType;
        while (baseType.getBaseType() != null) {
            baseType = (TypeInfo)baseType.getBaseType();
        }
       
        QName type = baseType.getQName();
        if (type.equals(XSD_STRING)) {
            return parseString(value);
        } else if (type.equals(XSD_INT)) {
            return parseInt(value);
        } else if (type.equals(XSD_INTEGER)) {
View Full Code Here

    public SimpleType2JavaTransformer(SimpleTypeMapper mapper) {
        this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperExtension();
    }

    public Object transform(T source, TransformationContext context) {
        TypeInfo simpleType = (TypeInfo)context.getSourceDataType().getMetadata(TypeInfo.class.getName());
        if (simpleType == null) {
            ElementInfo element =
                (ElementInfo)context.getSourceDataType().getMetadata(ElementInfo.class.getName());
            simpleType = (TypeInfo)element.getType();
        }
View Full Code Here

        if (value == null) {
            return null;
        }
        if (instance == null) {
            String text = value.getDocumentElement().getTextContent();
            TypeInfo xmlType = null;
            if (property.getJavaType() == null) {
                xmlType = new TypeInfo(property.getXmlType(), true, null);
            } else {
                xmlType = typeMapper.getXMLType(property.getJavaType());
            }
            if (xmlType == null) {
                throw new IllegalArgumentException("Complex property is not supported.");
View Full Code Here

        public ObjectFactoryImpl(Property<P> property, PropertyValue<P> propertyValue) {
            this.property = property;
            this.propertyValue = propertyValue;
            sourceDataType = new DataType<QName>(DOMDataBinding.NAME, Node.class, this.property.getXmlType());
            TypeInfo typeInfo = new TypeInfo(property.getXmlType(), true, null);
            ElementInfo elementInfo = new ElementInfo(null, typeInfo);
            sourceDataType.setMetadata(ElementInfo.class.getName(), elementInfo);
            Class javaType = this.property.getJavaType();
            String dataBinding = (String)property.getExtensions().get(DataBinding.class.getName());
            if (dataBinding != null) {
View Full Code Here

        }
        XmlSchemaType baseType = (XmlSchemaType) type.getBaseSchemaType();
        QName name = type.getQName();
        boolean simple = (type instanceof XmlSchemaSimpleType);
        if (baseType == null) {
            return new TypeInfo(name, simple, null);
        } else {
            return new TypeInfo(name, simple, getTypeInfo(baseType));
        }
    }
View Full Code Here

        op.setDataBinding(DOMDataBinding.NAME);

        inputType0.setMetadata(OPERATION_KEY, op);
        op.setWrapperStyle(true);
        ElementInfo inputElement =
            new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatus"), new TypeInfo(null, false, null));
        wrapperType.setMetadata(ElementInfo.class.getName(), inputElement);

        ElementInfo customerId =
            new ElementInfo(new QName("", "customerId"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES
                .get("string"));
        ElementInfo order =
            new ElementInfo(new QName("", "order"), new TypeInfo(new QName(URI_ORDER_XSD), false, null));
        ElementInfo flag =
            new ElementInfo(new QName("", "flag"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("int"));

        customerIdType.setMetadata(ElementInfo.class.getName(), customerId);
        orderType.setMetadata(ElementInfo.class.getName(), order);
        flagType.setMetadata(ElementInfo.class.getName(), flag);

        customerIdType.setMetadata(OPERATION_KEY, op);
        orderType.setMetadata(OPERATION_KEY, op);
        flagType.setMetadata(OPERATION_KEY, op);

        List<ElementInfo> inputElements = new ArrayList<ElementInfo>();
        inputElements.add(customerId);
        inputElements.add(order);
        inputElements.add(flag);

        ElementInfo statusElement =
            new ElementInfo(new QName("", "status"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("string"));

        statusType.setMetadata(ElementInfo.class.getName(), statusElement);
        statusType.setMetadata(OPERATION_KEY, op);

        List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
        outputElements.add(statusElement);

        ElementInfo outputElement =
            new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatusResponse"), new TypeInfo(null, false,
                                                                                               null));

        responseType.setMetadata(ElementInfo.class.getName(), inputElement);
        responseType.setMetadata(OPERATION_KEY, op);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.idl.TypeInfo

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.