本文整理了Java中org.apache.tuscany.sca.interfacedef.util.XMLType
类的一些代码示例,展示了XMLType
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLType
类的具体详情如下:
包路径:org.apache.tuscany.sca.interfacedef.util.XMLType
类名称:XMLType
[英]The metadata for an XML element or type.
[中]XML元素或类型的元数据。
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
if( returnXMLType.isElement() ) {
namespace = returnXMLType.getElementName().getNamespaceURI();
} else {
namespace = returnXMLType.getTypeName().getNamespaceURI();
XMLType xmlReturnType = new XMLType(new QName(namespace, "return"), null);
DataType<XMLType> returnDataType =
returnType == void.class ? null : new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, returnType, xmlReturnType);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public T transform(Object source, TransformationContext context) {
XMLType xmlType = (XMLType) context.getTargetDataType().getLogical();
String text = mapper.toXMLLiteral(xmlType.getTypeName(), source, context);
return createElement(xmlType.getElementName(), text, context);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom
/**
* @param context
* @param element
*/
public static void adjustElementName(TransformationContext context, OMElement element) {
if (context != null) {
DataType dataType = context.getTargetDataType();
Object logical = dataType == null ? null : dataType.getLogical();
if (!(logical instanceof XMLType)) {
return;
}
XMLType xmlType = (XMLType)logical;
if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
// FIXME:: Throw exception or switch to the new Element?
OMFactory factory = OMAbstractFactory.getOMFactory();
QName name = xmlType.getElementName();
OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
element.setNamespace(namespace);
element.setLocalName(name.getLocalPart());
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-assembly
public static XMLType getType(QName type) {
return new XMLType(null, type);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
Object logical = operation.getInputType().getLogical().get(i).getLogical();
if (logical instanceof XMLType) {
((XMLType)logical).setElementName(element);
DataType returnDataType = outputDataTypes.get(0);
if (returnDataType instanceof XMLType) {
((XMLType)returnDataType).setElementName(element);
Class<?> wrapperClass = Class.forName(inputWrapperClassName, false, clazz.getClassLoader());
QName qname = new QName(inputNS, inputName);
DataType dt = new DataTypeImpl<XMLType>(wrapperClass, new XMLType(qname, qname));
dataBindingExtensionPoint.introspectType(dt, operation);
QName inputWrapper = inputWrapperDT.getLogical().getElementName();
Class.forName(outputWrapperClassName, false, clazz.getClassLoader());
QName qname = new QName(outputNS, outputName);
DataType dt = new DataTypeImpl<XMLType>(wrapperClass, new XMLType(qname, qname));
dataBindingExtensionPoint.introspectType(dt, operation);
QName outputWrapper = outputWrapperDT.getLogical().getElementName();
QName type = null;
if (logical instanceof XMLType) {
((XMLType)logical).setElementName(element);
type = ((XMLType)logical).getTypeName();
QName type = null;
if (logical instanceof XMLType) {
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
private void createSyntheticBean(Operation operation, DataType exceptionType) {
DataType faultType = (DataType)exceptionType.getLogical();
QName faultBeanName = ((XMLType)faultType.getLogical()).getElementName();
List<DataType<XMLType>> beanDataTypes = new ArrayList<DataType<XMLType>>();
for (Method aMethod : exceptionType.getPhysical().getMethods()) {
QName propQName = new QName(faultBeanName.getNamespaceURI(), propName);
Class<?> propType = aMethod.getReturnType();
XMLType xmlPropType = new XMLType(propQName, null);
DataType<XMLType> propDT = new DataTypeImpl<XMLType>(propType, xmlPropType);
org.apache.tuscany.sca.databinding.annotation.DataType dt =
if (beanDataTypes.get(i).getLogical().getElementName().getLocalPart().compareTo(propName) > 0) {
break;
代码示例来源:origin: org.apache.tuscany.sca/tuscany-assembly
public boolean isMatchingType(Object type) {
if (faultName == null) {
return false;
}
if ((type instanceof QName) && faultName.equals(type)) {
return true;
}
if (type instanceof XMLType && faultName.equals(((XMLType)type).getElementName())) {
return true;
}
return false;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
QName faultName = ((XMLType)faultType.getLogical()).getElementName();
Class<?> faultBean = null;
final WebFault fault = cls.getAnnotation(WebFault.class);
if (fault != null) {
if (!"".equals(fault.name()) || !"".equals(fault.targetNamespace())) {
QName faultQName = ((XMLType)faultType.getLogical()).getElementName();
String faultNS =
"".equals(fault.targetNamespace()) ? faultQName.getNamespaceURI() : fault.targetNamespace();
String faultLocal = "".equals(fault.name()) ? faultQName.getLocalPart() : fault.name();
faultName = new QName(faultNS, faultLocal);
XMLType xmlType = new XMLType(faultName, null);
faultType.setLogical(xmlType);
try {
Class<?> faultBean = Class.forName(faultBeanClassName, false, cls.getClassLoader());
return new DataTypeImpl<XMLType>(faultBean, new XMLType(qname, qname));
} catch (ClassNotFoundException e) {
if (generatingFaultBean) {
return dt;
} else {
return new DataTypeImpl<XMLType>(cls, new XMLType(qname, qname));
XMLType faultTypeXML = (XMLType)faultType.getLogical();
faultTypeXML.setElementName(faultName);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding
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 {
if (logical instanceof XMLType) {
xmlType = ((XMLType)logical).getTypeName();
}
if (xmlType == null) {
xmlType = new QName(Introspector.decapitalize(javaType.getSimpleName()));
}
return new TypeInfo(xmlType, false, null);
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-wsdl
public WSDLPart(Part part, Class javaType) throws InvalidWSDLException {
this.part = part;
QName elementName = part.getElementName();
if (elementName != null) {
element = WSDLOperationIntrospectorImpl.this.getElement(elementName);
if (element == null) {
throw new InvalidWSDLException("Element cannot be resolved: " + elementName.toString());
}
} else {
// Create an faked XSD element to host the metadata
element = new XmlSchemaElement();
element.setName(part.getName());
element.setQName(new QName(null, part.getName()));
QName typeName = part.getTypeName();
if (typeName != null) {
XmlSchemaType type = WSDLOperationIntrospectorImpl.this.getType(typeName);
if (type == null) {
throw new InvalidWSDLException("Type cannot be resolved: " + typeName.toString());
}
element.setSchemaType(type);
element.setSchemaTypeName(type.getQName());
}
}
XMLType xmlType = new XMLType(getElementInfo(element));
xmlType.setNillable(element.isNillable());
xmlType.setMany(element.getMaxOccurs() > 1);
dataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-assembly-xml
} else if (LOGICAL_XMLTYPE_QNAME.equals(name)){
characterTarget = CharacterTarget.XMLTYPE;
logicalXMLType = new XMLType(null, null);
dataType.setLogical(logicalXMLType);
} else if (LOGICAL_TYPE_QNAME.equals(name)){
String localname = xmlType.substring(splitPoint + 1);
QName typeName = new QName(namespace, localname);
logicalXMLType.setTypeName(typeName);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public DataType<XMLType> run() {
try {
Class<?> wrapperClass =
Class.forName(outputWrapperClassName, false, clazz.getClassLoader());
QName qname = new QName(outputNS, outputName);
DataType dt = new DataTypeImpl<XMLType>(wrapperClass, new XMLType(qname, qname));
dataBindingExtensionPoint.introspectType(dt, operation);
// TUSCANY-2505
if (dt.getLogical() instanceof XMLType) {
XMLType xmlType = (XMLType)dt.getLogical();
xmlType.setElementName(qname);
}
return dt;
} catch (ClassNotFoundException e) {
GeneratedClassLoader cl = new GeneratedClassLoader(clazz.getClassLoader());
return new GeneratedDataTypeImpl(xmlAdapterExtensionPoint, method, outputWrapperClassName, outputNS, outputName,
false, cl);
}
}
});
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-wsdlgen
if (element == null || dataType.getLogical() instanceof XMLType) {
XMLType xmlType = (XMLType)dataType.getLogical();
if (xmlType.getElementName() != null) {
element = xmlType.getElementName();
if (logical instanceof XMLType && ((XMLType)logical).isMany()) {
element.setMany(true);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
if (logical instanceof XMLType &&
logical != XMLType.UNKNOWN) {
((XMLType)logical).setTypeName(xmlType.getTypeName());
} else {
dataType.setLogical(xmlType);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-sdo-axiom
/**
* @param context
* @param element
*/
public static void adjustElementName(TransformationContext context, OMElement element) {
if (context != null) {
DataType dataType = context.getTargetDataType();
Object logical = dataType == null ? null : dataType.getLogical();
if (!(logical instanceof XMLType)) {
return;
}
XMLType xmlType = (XMLType)logical;
if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
// FIXME:: Throw exception or switch to the new Element?
OMFactory factory = OMAbstractFactory.getOMFactory();
QName name = xmlType.getElementName();
OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
element.setNamespace(namespace);
element.setLocalName(name.getLocalPart());
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public static XMLType getType(QName type) {
return new XMLType(null, type);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding
public T transform(Object source, TransformationContext context) {
XMLType xmlType = (XMLType) context.getTargetDataType().getLogical();
String text = mapper.toXMLLiteral(xmlType.getTypeName(), source, context);
return createElement(xmlType.getElementName(), text, context);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding
@Override
public boolean introspect(DataType type, Operation operation) {
Class<?> cls = type.getPhysical();
if (cls == Object.class) {
return false;
}
// HACK: [rfeng] By pass the one know to XMLString
String db = type.getDataBinding();
if (db != null && (XMLStringDataBinding.NAME.equals(db))) {
return false;
}
if (SimpleTypeMapperImpl.JAVA2XML.keySet().contains(cls)) {
type.setDataBinding(NAME);
QName elementName = null;
Object logical = type.getLogical();
if (logical instanceof XMLType) {
elementName = ((XMLType)logical).getElementName();
}
TypeInfo typeInfo = simpleTypeMapper.getXMLType(cls);
type.setLogical(new XMLType(elementName, typeInfo == null ? null : typeInfo.getQName()));
return true;
} else {
return false;
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public boolean isMatchingType(Object type) {
if (faultName == null) {
return false;
}
if ((type instanceof QName) && faultName.equals(type)) {
return true;
}
if (type instanceof XMLType && faultName.equals(((XMLType)type).getElementName())) {
return true;
}
return false;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
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 {
if (logical instanceof XMLType) {
xmlType = ((XMLType)logical).getTypeName();
}
if (xmlType == null) {
xmlType = new QName(Introspector.decapitalize(javaType.getSimpleName()));
}
return new TypeInfo(xmlType, false, null);
}
}
内容来源于网络,如有侵权,请联系作者删除!