org.apache.tuscany.sca.interfacedef.util.XMLType.getTypeName()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中org.apache.tuscany.sca.interfacedef.util.XMLType.getTypeName()方法的一些代码示例,展示了XMLType.getTypeName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLType.getTypeName()方法的具体详情如下:
包路径:org.apache.tuscany.sca.interfacedef.util.XMLType
类名称:XMLType
方法名:getTypeName

XMLType.getTypeName介绍

暂无

代码示例

代码示例来源: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-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);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-jaxb

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);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-assembly-xml

writer.writeStartElement(Constants.SCA11_TUSCANY_NS, XMLTYPE);
XMLType xmlType = (XMLType)dataType.getLogical();
if (xmlType.getTypeName() != null){
  writer.writeCharacters(xmlType.getTypeName().toString());
} else {
  writer.writeCharacters("NoType");

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

writer.writeStartElement(Constants.SCA11_TUSCANY_NS, XMLTYPE);
XMLType xmlType = (XMLType)dataType.getLogical();
if (xmlType.getTypeName() != null){
  writer.writeCharacters(xmlType.getTypeName().toString());
} else {
  writer.writeCharacters("NoType");

代码示例来源: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 {
    // 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);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding

public Object transform(T source, TransformationContext context) {
  XMLType xmlType = (XMLType)context.getSourceDataType().getLogical();
  QName type = (xmlType != null) ? xmlType.getTypeName() : null;
  if (type == null) {
    xmlType = (XMLType)context.getTargetDataType().getLogical();
    type = (xmlType != null) ? xmlType.getTypeName() : null;
  }
  Object result = mapper.toJavaObject(type, getText(source), context);
  close(source);
  return result;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

public Object transform(T source, TransformationContext context) {
  XMLType xmlType = (XMLType)context.getSourceDataType().getLogical();
  QName type = (xmlType != null) ? xmlType.getTypeName() : null;
  if (type == null) {
    xmlType = (XMLType)context.getTargetDataType().getLogical();
    type = (xmlType != null) ? xmlType.getTypeName() : null;
  }
  Object result = mapper.toJavaObject(type, getText(source), context);
  close(source);
  return result;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

namespace = returnXMLType.getElementName().getNamespaceURI();
} else {
  namespace = returnXMLType.getTypeName().getNamespaceURI();

代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-java

namespace = returnXMLType.getElementName().getNamespaceURI();
} else {
  namespace = returnXMLType.getTypeName().getNamespaceURI();

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-jaxb

public static Class<?> getJavaType(DataType<?> dataType) {
  if (dataType == null) {
    return null;
  }
  Class type = dataType.getPhysical();
  if (JAXBElement.class.isAssignableFrom(type)) {
    Type generic = dataType.getGenericType();
    type = Object.class;
  }
  if (type == Object.class && dataType.getLogical() instanceof XMLType) {
    XMLType xType = (XMLType)dataType.getLogical();
    Class javaType = SIMPLE_TYPE_MAPPER.getJavaType(xType.getTypeName());
    if (javaType != null) {
      type = javaType;
    }
  }
  return type;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

public static Class<?> getJavaType(DataType<?> dataType) {
  if (dataType == null) {
    return null;
  }
  Class type = dataType.getPhysical();
  if (JAXBElement.class.isAssignableFrom(type)) {
    Type generic = dataType.getGenericType();
    type = Object.class;
  }
  if (type == Object.class && dataType.getLogical() instanceof XMLType) {
    XMLType xType = (XMLType)dataType.getLogical();
    Class javaType = SIMPLE_TYPE_MAPPER.getJavaType(xType.getTypeName());
    if (javaType != null) {
      type = javaType;
    }
  }
  return type;
}

代码示例来源: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

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

public Object transform(T source, TransformationContext context) {
  //FIXME why is the logical type sometimes a Class instead of an XMLType?
  if (context.getSourceDataType().getLogical() instanceof XMLType) {
    XMLType xmlType = (XMLType) context.getSourceDataType().getLogical();
    return toJavaObject(xmlType.getTypeName(), getRootElement(source), context);
  } else {
    return toJavaObject(null, getRootElement(source), context);
  }
}

代码示例来源: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-base-runtime

public Object transform(T source, TransformationContext context) {
  //FIXME why is the logical type sometimes a Class instead of an XMLType?
  if (context.getSourceDataType().getLogical() instanceof XMLType) {
    XMLType xmlType = (XMLType) context.getSourceDataType().getLogical();
    return toJavaObject(xmlType.getTypeName(), getRootElement(source), context);
  } else {
    return toJavaObject(null, getRootElement(source), context);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

public Part generatePart(Definition definition, DataType arg, String partName) {
  Part part = definition.createPart();
  part.setName(partName);
  if (arg != null && arg.getLogical() instanceof XMLType) {
    XMLType xmlType = (XMLType)arg.getLogical();
    QName elementName = xmlType.getElementName();
    part.setElementName(elementName);
    addNamespace(definition, elementName);
    if (xmlType.getElementName() == null) {
      QName typeName = xmlType.getTypeName();
      part.setTypeName(typeName);
      addNamespace(definition, typeName);
    }
  }
  return part;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-wsdlgen

public Part generatePart(Definition definition, DataType arg, String partName) {
  Part part = definition.createPart();
  part.setName(partName);
  if (arg != null && arg.getLogical() instanceof XMLType) {
    XMLType xmlType = (XMLType)arg.getLogical();
    QName elementName = xmlType.getElementName();
    part.setElementName(elementName);
    addNamespace(definition, elementName);
    if (xmlType.getElementName() == null) {
      QName typeName = xmlType.getTypeName();
      part.setTypeName(typeName);
      addNamespace(definition, typeName);
    }
  }
  return part;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

@Override
public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
  for (Property property : type.getProperties()) {
    String name = property.getName();
    JavaElementImpl element = type.getPropertyMembers().get(name);
    introspect(property, element);
    DataType dt = property.getDataType();
    Object logical = dt.getLogical();
    if (logical instanceof XMLType &&
      logical != XMLType.UNKNOWN) {
      XMLType xmlType = (XMLType)logical;
      property.setXSDType(xmlType.getTypeName());
      property.setXSDElement(xmlType.getElementName());
    } else {
      Class<?> baseType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
      QName typeName = JavaXMLMapper.getXMLType(baseType);                   
      property.setXSDType(typeName);
    }
  }
  super.visitEnd(clazz, type);
}

相关文章