本文整理汇总了Java中com.leansoft.mxjc.model.TypeInfo类的典型用法代码示例。如果您正苦于以下问题:Java TypeInfo类的具体用法?Java TypeInfo怎么用?Java TypeInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeInfo类属于com.leansoft.mxjc.model包,在下文中一共展示了TypeInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInterfaceImports
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
/**
*
* Helper to find out all classes that will be imported by an service endpoint interface
*
* @param intf
* , InterfaceInfo instance
* @return a set of class names that will be imported
*/
private Set<String> getInterfaceImports(SEIInfo intf) {
Set<String> imports = new HashSet<String>();
for (MethodInfo method : intf.getMethods()) {
// import method parameter types
for (ParameterInfo param : method.getParameters()) {
TypeInfo paramType = param.getType();
imports.add(paramType.getFullName());
}
// import return type
TypeInfo returnType = method.getReturnType();
imports.add(returnType.getFullName());
}
return imports;
}
示例2: getInterfaceImports
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
/**
*
* Helper to find out all classes that will be imported by an interface
*
* @param intf
* , InterfaceInfo instance
* @return a set of class names that will be imported
*/
private Set<String> getInterfaceImports(SEIInfo intf) {
Set<String> imports = new HashSet<String>();
for (MethodInfo method : intf.getMethods()) {
// import method parameter types
for (ParameterInfo param : method.getParameters()) {
TypeInfo paramType = param.getType();
imports.add(paramType.getFullName());
}
// import return type
TypeInfo returnType = method.getReturnType();
imports.add(returnType.getFullName());
}
return imports;
}
示例3: getFaultInfo
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
private FaultInfo getFaultInfo(Fault fault) {
FaultInfo faultInfo = new FaultInfo();
String className = Names.customExceptionClassName(fault);
faultInfo.setFullName(className);
faultInfo.setPackageName(ClassNameUtil.getPackageName(className));
faultInfo.setName(ClassNameUtil.stripQualifier(className));
if (fault.getJavaDoc() != null) {
faultInfo.setDocComment(fault.getJavaDoc());
}
String localPart = fault.getBlock().getName().getLocalPart();
String targetNamespace = fault.getBlock().getName().getNamespaceURI();
QName schemaName = new QName(localPart, targetNamespace);
faultInfo.setSchemaName(schemaName);
JType faultBean = fault.getBlock().getType().getJavaType().getType().getType();
TypeInfo faultBeanTypeInfo = new TypeInfo();
faultBeanTypeInfo.setFullName(faultBean.fullName());
faultBeanTypeInfo.setName(faultBean.name());
faultInfo.setFaultBeanTypeInfo(faultBeanTypeInfo);
return faultInfo;
}
示例4: convertType
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
/**
* Check and convert a type
*
* @param type, TypeInfo instance
*/
private void convertType(TypeInfo type) {
String targetTypeFullName = typeMapping.get(type.getFullName());
if (targetTypeFullName != null) {
type.setFullName(targetTypeFullName);
type.setName(ClassNameUtil.stripQualifier(targetTypeFullName));
} else {
if (type.isCollection()) { // special handling for collection type
for(String oldTypeFullName : typeMapping.keySet()) {
if (type.getFullName().indexOf(oldTypeFullName) > 0) { // including type parameter?
String newTypeFullName = typeMapping.get(oldTypeFullName);
String newFullName = type.getFullName().replace(oldTypeFullName, newTypeFullName);
String oldSimpleName = ClassNameUtil.stripQualifier(oldTypeFullName);
String newSimpleName = ClassNameUtil.stripQualifier(newTypeFullName);
String newName = type.getName().replace(oldSimpleName, newSimpleName);
type.setFullName(newFullName);
type.setName(newName);
}
}
}
}
}
示例5: getFieldImports
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
private Set<String> getFieldImports(ClassInfo clazz) {
Set<String> imports = new HashSet<String>();
for(FieldInfo field : clazz.getFields()) {
TypeInfo fieldType = field.getType();
if (fieldType.isArray()) {
TypeInfo elementType = fieldType.getElementType();
if (elementType != null && !elementType.isPrimitive() && !elementType.isEnum()) {
imports.add(elementType.getFullName());
}
} else {
if (!fieldType.isPrimitive() && !fieldType.isEnum() && !fieldType.isCollection()) {
imports.add(fieldType.getFullName());
}
}
// import type parameters
for(TypeInfo paraType : fieldType.getTypeParameters()) { // object type
if (!paraType.isPrimitive() && !paraType.isEnum() && !field.isAny()) {
imports.add(paraType.getFullName());
}
}
}
return imports;
}
示例6: convertType
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
/**
* Check and covert a type
*
* @param type
*/
private void convertType(TypeInfo type) {
if (type == null) return; // be cautious
String picoPrimitiveType = Java2PicoTypeMapper.lookupPicoType(type.getFullName());
if (picoPrimitiveType != null) {// pico primitive type
type.setFullName(PicoTypeMapper.lookupWrapper(picoPrimitiveType));
type.setName(picoPrimitiveType); // pico primitive
type.setPrimitive(true);
} else if (type.isEnum()) {
type.setName(PicoType.ENUM); // pico enum type
type.setPrimitive(true); // treat enum as primitive type
} else {
type.setName(PicoType.OBJECT);
type.setPrimitive(false);
}
}
示例7: prefixType
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
private void prefixType(WSCodeGenModel model, String prefix) {
for (SEIInfo intf : model.getServiceEndpointInterfaces()) {
// update method i/o types
for (MethodInfo method : intf.getMethods()) {
// input parameter types
for (ParameterInfo param : method.getParameters()) {
TypeInfo paramType = param.getType();
prefixType(paramType, prefix);
}
// output type
TypeInfo returnType = method.getReturnType();
prefixType(returnType, prefix);
}
}
}
示例8: convertFieldsType
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
/**
* check every field of a class and convert type if necessary
*
* @param clazz
* , ClassInfo instance to be converted
*/
private void convertFieldsType(ClassInfo clazz) {
for (FieldInfo field : clazz.getFields()) {
TypeInfo fieldType = field.getType();
convertType(fieldType);
// convert type parameters
for (TypeInfo paraType : fieldType.getTypeParameters()) {
convertType(paraType);
}
}
}
示例9: prefixType
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
private void prefixType(TypeInfo type, String prefix) {
if (type == null) return; // be cautious
// for pico primitives, do not prefix
if (Java2PicoTypeMapper.lookupPicoType(type.getFullName()) != null) {
return;
}
String name = type.getName();
type.setName(prefix + name);
type.setFullName(prefix + name); // remove package for pico
}
示例10: getSuperClassImports
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
private Set<String> getSuperClassImports(ClassInfo clazz) {
Set<String> imports = new HashSet<String>();
// extends super class?
if (clazz.getSuperClass() != null) {
TypeInfo superClassType = clazz.getSuperClass();
imports.add(superClassType.getFullName());
}
return imports;
}
示例11: convertFieldsType
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
private void convertFieldsType(ClassInfo clazz) {
for (FieldInfo field : clazz.getFields()) {
TypeInfo fieldType = field.getType();
convertType(fieldType);
// TODO should element type of array be converted?
// if (fieldType.isArray()) {
// convertType(fieldType.getElementType());
// }
// convert type parameters
for(TypeInfo paraType : fieldType.getTypeParameters()) {
convertType(paraType);
}
}
}
示例12: getFaultBeanTypeInfo
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
public TypeInfo getFaultBeanTypeInfo() {
return faultBeanTypeInfo;
}
示例13: setFaultBeanTypeInfo
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
public void setFaultBeanTypeInfo(TypeInfo faultBeanTypeInfo) {
this.faultBeanTypeInfo = faultBeanTypeInfo;
}
示例14: adjustPackageNameOfNestClass
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
private void adjustPackageNameOfNestClass(List<ClassInfo> classes) {
for(ClassInfo classInfo : classes) {
// adjust class
if (classInfo.isNestClass()) {
String pkgName = classInfo.getPackageName().toLowerCase();
classInfo.setPackageName(pkgName);
classInfo.setFullName(pkgName + "." + classInfo.getName());
}
// adjust fields
for(FieldInfo fieldInfo : classInfo.getFields()) {
TypeInfo attrType = fieldInfo.getType();
// no need to handle primitive type
if (attrType.isPrimitive())
continue;
// handle array
if (attrType.isArray()) {
// T of T[]
TypeInfo elementType = attrType.getElementType();
// no need to handle primitive type
if (elementType.isPrimitive()) {
continue;
}
if (elementType.isNestClass()) {
String elementTypePackageName = ClassNameUtil
.getPackageName(elementType.getFullName());
elementTypePackageName = elementTypePackageName.toLowerCase();
elementType.setFullName(elementTypePackageName + "." + elementType.getName());
}
continue;
}
if (attrType.isNestClass()) {
String attrTypePackageName = ClassNameUtil.getPackageName(attrType.getFullName());
attrTypePackageName = attrTypePackageName.toLowerCase();
attrType.setFullName(attrTypePackageName + "." + attrType.getName());
}
// has type parameters?
for (TypeInfo paramType : attrType.getTypeParameters()) {
if (paramType.isNestClass()) {
String paramTypePackageName = ClassNameUtil
.getPackageName(paramType.getFullName());
paramTypePackageName = paramTypePackageName.toLowerCase();
paramType.setFullName(paramTypePackageName + "." + paramType.getName());
}
}
}
}
}
示例15: getClassImports
import com.leansoft.mxjc.model.TypeInfo; //导入依赖的package包/类
/**
*
* helper to find out all classes that should be imported by a class
*
* @param clazz
* , ClassInfo instance
* @return a set of class names that should be imported
*/
private Set<String> getClassImports(ClassInfo clazz) {
Set<String> imports = new HashSet<String>();
String clazzPackageName = clazz.getPackageName();
// extends super class?
if (clazz.getSuperClass() != null) {
TypeInfo superClassType = clazz.getSuperClass();
String superClassTypePackageName = ClassNameUtil
.getPackageName(superClassType.getFullName());
if (needImport(clazzPackageName, superClassTypePackageName)) {
imports.add(ClassNameUtil.erase(superClassType.getFullName()));
}
}
// import field type
for (FieldInfo field : clazz.getFields()) {
TypeInfo attrType = field.getType();
String attrTypePackageName = ClassNameUtil.getPackageName(attrType.getFullName());
// no import for primitive type
if (attrType.isPrimitive())
continue;
// import component type of array
if (attrType.isArray()) {
// T of T[]
TypeInfo elementType = attrType.getElementType();
// no import for primitive type
if (elementType.isPrimitive()) {
continue;
}
String elementTypePackageName = ClassNameUtil
.getPackageName(elementType.getFullName());
if (needImport(clazzPackageName, elementTypePackageName)) {
imports.add(ClassNameUtil.erase(elementType.getFullName()));
}
continue;
}
if (needImport(clazzPackageName, attrTypePackageName)) {
// erase type parameters before import
imports.add(ClassNameUtil.erase(attrType.getFullName()));
}
// has type parameters?
for (TypeInfo paramType : attrType.getTypeParameters()) {
String paramTypePackageName = ClassNameUtil
.getPackageName(paramType.getFullName());
if (needImport(clazzPackageName, paramTypePackageName)) {
// erase type parameters before import
imports.add(ClassNameUtil.erase(paramType.getFullName()));
}
}
}
return imports;
}