Package org.apache.tuscany.sca.interfacedef.util

Examples of org.apache.tuscany.sca.interfacedef.util.TypeInfo


            this.propertyValue = propertyValue;
            this.javaType = javaType;
            sourceDataType =
                new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class,
                    new XMLType(null, this.property.getXSDType()));
            TypeInfo typeInfo = null;
            if (this.property.getXSDType() != null) {
                if (SimpleTypeMapperImpl.isSimpleXSDType(this.property.getXSDType())) {
                    typeInfo = new TypeInfo(property.getXSDType(), true, null);
                } else {
                    typeInfo = new TypeInfo(property.getXSDType(), false, null);
                }
            } else {
                typeInfo = new TypeInfo(property.getXSDType(), false, null);
            }

            XMLType xmlType = new XMLType(typeInfo);
            String dataBinding = null; //(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

            QName elementName = null;
            Object logical = type.getLogical();
            if (logical instanceof XMLType) {
                elementName = ((XMLType)logical).getElementName();
            }
            TypeInfo typeInfo = SimpleTypeMapperImpl.getXMLType(cls);
            type.setLogical(new XMLType(elementName, typeInfo == null ? null : typeInfo.getQName()));
            return true;
        } else {
            return false;
        }
    }
View Full Code Here

    }

    public TypeInfo getTypeInfo(Class javaType, Object logical) {
        QName xmlType = JavaXMLMapper.getXMLType(javaType);
        if (xmlType != null) {
            return new TypeInfo(xmlType, true, null);
        } else if (javaType.isInterface()) {
            return new TypeInfo(ANYTYPE_QNAME, true, null);
        } else {
            // types.add(javaType);
            if (logical instanceof XMLType) {
                xmlType = ((XMLType)logical).getTypeName();
            }
            if (xmlType == null) {
                xmlType = new QName(JAXBContextHelper.jaxbDecapitalize(javaType.getSimpleName()));
            }
            return new TypeInfo(xmlType, false, null);
        }
    }
View Full Code Here

            this.property = property;
            this.propertyValue = propertyValue;
            this.javaType = javaType;
            sourceDataType = new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(null, this.property
                .getXSDType()));
            TypeInfo typeInfo = null;
            if (this.property.getXSDType() != null) {
                if (SimpleTypeMapperImpl.isSimpleXSDType(this.property.getXSDType())) {
                    typeInfo = new TypeInfo(property.getXSDType(), true, null);
                } else {
                    typeInfo = new TypeInfo(property.getXSDType(), false, null);
                }
            } else {
                typeInfo = new TypeInfo(property.getXSDType(), false, null);
            }

            XMLType xmlType = new XMLType(typeInfo);
            String dataBinding = null; // (String)property.getExtensions().get(DataBinding.class.getName());
            if (dataBinding != null) {
View Full Code Here

                    XMLType xmlType = (XMLType)dataType.getLogical();
                    if (xmlType.getElementName() != null) {
                        element = xmlType.getElementName();
                    }
                }
                return new ElementInfo(element, new TypeInfo(ANYTYPE_QNAME, false, null));
                // throw new ServiceRuntimeException("No data binding for " + db);
            }

            helper = dataBinding.getXMLTypeHelper();
            if (helper == null) {
                // Default to JAXB
                helper = helpers.get(JAXBDataBinding.NAME);
                if (helper == null) {
                    helper = dataBindings.getDataBinding(JAXBDataBinding.NAME).getXMLTypeHelper();
                    helpers.put(JAXBDataBinding.NAME, helper);
                }
            }
            helpers.put(db, helper);
        }
        TypeInfo typeInfo = helper.getTypeInfo(javaType.isArray() ? javaType.getComponentType() : javaType,
                                               dataType.getLogical());
        ElementInfo element = new ElementInfo(name, typeInfo);
        element.setMany(byte[].class != javaType && javaType.isArray());
        element.setNillable(!javaType.isPrimitive());
        return element;
View Full Code Here

        Property prop =
            xsdHelper.getGlobalProperty(element.getQName().getNamespaceURI(), element.getQName().getLocalPart(), true);
        if (prop != null) {
            sdoType = prop.getType();
        } else {
            TypeInfo type = element.getType();
            QName typeName = type != null ? type.getQName() : null;
            if (typeName != null) {
                sdoType = helperContext.getTypeHelper().getType(typeName.getNamespaceURI(), typeName.getLocalPart());
            }
        }
        return sdoType;
View Full Code Here

            this.property = property;
            this.propertyValue = propertyValue;
            this.javaType = javaType;
            sourceDataType = new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(null, this.property
                .getXSDType()));
            TypeInfo typeInfo = null;
            if (this.property.getXSDType() != null) {
                if (SimpleTypeMapperImpl.isSimpleXSDType(this.property.getXSDType())) {
                    typeInfo = new TypeInfo(property.getXSDType(), true, null);
                } else {
                    typeInfo = new TypeInfo(property.getXSDType(), false, null);
                }
            } else {
                typeInfo = new TypeInfo(property.getXSDType(), false, null);
            }

            XMLType xmlType = new XMLType(typeInfo);
            String dataBinding = null; // (String)property.getExtensions().get(DataBinding.class.getName());
            if (dataBinding != null) {
View Full Code Here

     * @param childElement
     * @param element
     * @return
     */
    private OMElement attachXSIType(ElementInfo childElement, OMElement element) {
        TypeInfo type = childElement.getType();
        if (type != null && type.getQName() != null) {
            OMAttribute attr = element.getAttribute(XSI_TYPE_QNAME);
            if (attr == null) {
                String typeNS = type.getQName().getNamespaceURI();
                if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(typeNS)) {
                    return element;
                }
                OMNamespace ns = element.getOMFactory().createOMNamespace(typeNS, "_typens_");
                element.declareNamespace(ns);
                OMNamespace xsiNS =
                    element.getOMFactory().createOMNamespace(XSI_TYPE_QNAME.getNamespaceURI(),
                                                             XSI_TYPE_QNAME.getPrefix());
                element.declareNamespace(xsiNS);
                attr =
                    element.getOMFactory().createOMAttribute("type",
                                                             xsiNS,
                                                             "_typens_:" + type.getQName().getLocalPart());
                element.addAttribute(attr);
            }
        }
        return element;
    }
View Full Code Here

        private static String getStringValue(Object o) {
            if (o == null) {
                return null;
            }
            TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
            if (info != null) {
                return MAPPER.toXMLLiteral(info.getQName(), o, null);
            } else {
                return String.valueOf(o);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.interfacedef.util.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.