本文整理汇总了Java中com.sun.tools.xjc.outline.FieldOutline.getPropertyInfo方法的典型用法代码示例。如果您正苦于以下问题:Java FieldOutline.getPropertyInfo方法的具体用法?Java FieldOutline.getPropertyInfo怎么用?Java FieldOutline.getPropertyInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.xjc.outline.FieldOutline
的用法示例。
在下文中一共展示了FieldOutline.getPropertyInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPossibleTypes
import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public static Set<JType> getPossibleTypes(FieldOutline fieldOutline,
Aspect aspect) {
Validate.notNull(fieldOutline);
final ClassOutline classOutline = fieldOutline.parent();
final Outline outline = classOutline.parent();
final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
final Set<JType> types = new HashSet<JType>();
if (propertyInfo.getAdapter() != null) {
types.add(propertyInfo.getAdapter().customType.toType(fieldOutline
.parent().parent(), aspect));
} else if (propertyInfo.baseType != null) {
types.add(propertyInfo.baseType);
} else {
Collection<? extends CTypeInfo> typeInfos = propertyInfo.ref();
for (CTypeInfo typeInfo : typeInfos) {
types.addAll(getPossibleTypes(outline, aspect, typeInfo));
}
}
return types;
}
示例2: getIdFieldsOutline
import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
private Collection<FieldOutline> getIdFieldsOutline(
final ClassOutline classOutline) {
final Collection<FieldOutline> idFieldOutlines = new ArrayList<FieldOutline>();
ClassOutline current = classOutline;
while (current != null) {
for (FieldOutline idFieldOutline : current.getDeclaredFields()) {
final CPropertyInfo propertyInfo = idFieldOutline
.getPropertyInfo();
if ((CustomizationUtils.containsCustomization(propertyInfo,
Customizations.ID_ELEMENT_NAME) || CustomizationUtils
.containsCustomization(propertyInfo,
Customizations.EMBEDDED_ID_ELEMENT_NAME))
&& !CustomizationUtils.containsCustomization(
propertyInfo,
Customizations.IGNORED_ELEMENT_NAME)) {
idFieldOutlines.add(idFieldOutline);
}
}
current = current.getSuperClass();
}
return idFieldOutlines;
}
示例3: isFieldOutlineEnumerated
import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public boolean isFieldOutlineEnumerated(Mapping context,
FieldOutline fieldOutline) {
final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
final Collection<? extends CTypeInfo> types = context.getGetTypes()
.process(context, propertyInfo);
if (types.size() == 1) {
final CTypeInfo type = types.iterator().next();
return type instanceof CEnumLeafInfo;
} else {
return false;
}
}
示例4: getExtensionsField
import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
static
private FieldOutline getExtensionsField(final ClassOutline clazz){
FieldFilter filter = new FieldFilter(){
@Override
public boolean accept(FieldOutline field){
CPropertyInfo propertyInfo = field.getPropertyInfo();
if(("extensions").equals(propertyInfo.getName(false)) && propertyInfo.isCollection()){
JType elementType = CodeModelUtil.getElementType(field.getRawType());
return checkType(elementType, "org.dmg.pmml.Extension");
}
return false;
}
};
return CodeModelUtil.findField(clazz.getDeclaredFields(), filter);
}
示例5: isFieldOutlineEnumerated
import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public boolean isFieldOutlineEnumerated(Mapping context,
FieldOutline fieldOutline) {
final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
final Collection<? extends CTypeInfo> types = context.getGetTypes()
.process(context, propertyInfo);
if (types.size() == 1) {
final CTypeInfo type = types.iterator().next();
return type instanceof CEnumLeafInfo;
} else {
return false;
}
}
示例6: getCommonBaseTypeInfo
import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public CTypeInfo getCommonBaseTypeInfo(Mapping context,
FieldOutline fieldOutline) {
final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
final Collection<? extends CTypeInfo> types = context.getGetTypes()
.process(context, propertyInfo);
return CTypeInfoUtils.getCommonBaseTypeInfo(types);
}
示例7: discoverDirectClasses
import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
/**
* Finds all external class references
* @param outline root of the generated code
* @param classes set of generated classes
* @return set of external classes
* @throws IllegalAccessException throw if there's an error introspecting the annotations
*/
static Set<JClass> discoverDirectClasses(Outline outline, Set<ClassOutline> classes) throws IllegalAccessException {
Set<String> directClassNames = new LinkedHashSet<>();
for(ClassOutline classOutline : classes) {
// for each field, if it's a bean, then visit it
List<FieldOutline> fields = findAllDeclaredAndInheritedFields(classOutline);
for(FieldOutline fieldOutline : fields) {
JType rawType = fieldOutline.getRawType();
CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
boolean isCollection = propertyInfo.isCollection();
if (isCollection) {
JClass collClazz = (JClass) rawType;
JClass collType = collClazz.getTypeParameters().get(0);
addIfDirectClass(directClassNames, collType);
} else {
addIfDirectClass(directClassNames, rawType);
}
parseXmlAnnotations(outline, fieldOutline, directClassNames);
}
}
Set<JClass> direct = directClassNames
.stream()
.map(cn -> outline.getCodeModel().directClass(cn))
.collect(Collectors.toCollection(LinkedHashSet::new));
return direct;
}
示例8: getFields
import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
private static List<FieldInfo> getFields(CGConfig cgConfig, ClassOutline co) {
List<FieldInfo> fields = new ArrayList<>();
for (FieldOutline fo : co.getDeclaredFields()) {
FieldInfo fieldInfo = new FieldInfo();
// field name
ClientModule clientModule = cgConfig.module.getClientModule();
fieldInfo.setName(clientModule.generateSafeName(fo.getPropertyInfo().getName(false)));
fieldInfo.setInitialName(fo.getPropertyInfo().getName(false));
fieldInfo.setRequired(isRequired(fo));
JType rawType = fo.getRawType();
TypeInfo typeInfo = buildTypeInfo(rawType);
if (rawType.isArray()) {
typeInfo.setArray(true);
typeInfo.setElementType(buildTypeInfo(rawType.elementType())); // T of T[]
}
typeInfo.getTypeParameters().addAll(getTypeParameters(rawType));
fieldInfo.setType(typeInfo);
// schema kind
CPropertyInfo cProp = fo.getPropertyInfo();
fieldInfo.setPropertyKindElement(cProp.kind() == PropertyKind.ELEMENT);
fieldInfo.setPropertyKindAttribute(cProp.kind() == PropertyKind.ATTRIBUTE);
fieldInfo.setPropertyKindValue(cProp.kind() == PropertyKind.VALUE);
fieldInfo.setPropertyKindAny(cProp.kind() == PropertyKind.REFERENCE);
setAnnotation(co, fieldInfo, cProp);
fieldInfo.getType().setCollection(cProp.isCollection());
setDocComment(fo, fieldInfo);
if (fieldInfo.isRequired() && fieldInfo.getType().isCollection()) {
System.out.println("min occurs : 1 " + co.implClass.name() + "." + fieldInfo.getInitialName());
}
fields.add(fieldInfo);
}
return fields;
}