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

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


        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


        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

        }
        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

     * @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

                    QName type = null;
                    if (logical instanceof XMLType) {
                        ((XMLType)logical).setElementName(element);
                        type = ((XMLType)logical).getTypeName();
                    }
                    inputElements.add(new ElementInfo(element, new TypeInfo(type, false, null)));
                    if (param != null) {
                        parameterModes.set(i, getParameterMode(parameterTypes[i], param.mode()));
                    } else {
                        parameterModes.set(i, getParameterMode(parameterTypes[i], null));
                    }
                }

                List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
                WebResult result = method.getAnnotation(WebResult.class);
                // Default to "" for doc-lit-wrapped && non-header
                ns = result != null ? result.targetNamespace() : "";
                ns = getValue(ns, documentStyle && (result == null || !result.header()) ? "" : tns);
                name = result != null ? result.name() : "";
                name = getValue(name, "return");
                QName element = new QName(ns, name);

                if (operation.getOutputType() != null) {
                    Object logical = operation.getOutputType().getLogical();
                    QName type = null;
                    if (logical instanceof XMLType) {
                        ((XMLType)logical).setElementName(element);
                        type = ((XMLType)logical).getTypeName();
                    }
                    outputElements.add(new ElementInfo(element, new TypeInfo(type, false, null)));
                }

                String db = inputWrapperDT != null ? inputWrapperDT.getDataBinding() : JAXB_DATABINDING;

                WrapperInfo inputWrapperInfo = new WrapperInfo(db, new ElementInfo(inputWrapper, null), inputElements);
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.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

                    QName type = null;
                    if (logical instanceof XMLType) {
                        ((XMLType)logical).setElementName(element);
                        type = ((XMLType)logical).getTypeName();
                    }
                    inputElements.add(new ElementInfo(element, new TypeInfo(type, false, null)));
                    if (param != null) {
                        parameterModes.set(i, getParameterMode(parameterTypes[i], param.mode()));
                    } else {
                        parameterModes.set(i, getParameterMode(parameterTypes[i], null));
                    }
                }

                List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
                WebResult result = method.getAnnotation(WebResult.class);
                // Default to "" for doc-lit-wrapped && non-header
                ns = result != null ? result.targetNamespace() : "";
                ns = getValue(ns, documentStyle && (result == null || !result.header()) ? "" : tns);
                name = result != null ? result.name() : "";
                name = getValue(name, "return");
                QName element = new QName(ns, name);

                if (operation.getOutputType() != null) {
                    Object logical = operation.getOutputType().getLogical();
                    QName type = null;
                    if (logical instanceof XMLType) {
                        ((XMLType)logical).setElementName(element);
                        type = ((XMLType)logical).getTypeName();
                    }
                    outputElements.add(new ElementInfo(element, new TypeInfo(type, false, null)));
                }

                String db = inputWrapperDT != null ? inputWrapperDT.getDataBinding() : JAXB_DATABINDING;

                WrapperInfo inputWrapperInfo = new WrapperInfo(db, new ElementInfo(inputWrapper, null), inputElements);
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

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.