本文整理汇总了Java中com.sun.tools.xjc.model.CPropertyInfo.isCollection方法的典型用法代码示例。如果您正苦于以下问题:Java CPropertyInfo.isCollection方法的具体用法?Java CPropertyInfo.isCollection怎么用?Java CPropertyInfo.isCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.xjc.model.CPropertyInfo
的用法示例。
在下文中一共展示了CPropertyInfo.isCollection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExtensionsField
import com.sun.tools.xjc.model.CPropertyInfo; //导入方法依赖的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);
}
示例2: discoverDirectClasses
import com.sun.tools.xjc.model.CPropertyInfo; //导入方法依赖的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;
}
示例3: pluralizeIfNecessary
import com.sun.tools.xjc.model.CPropertyInfo; //导入方法依赖的package包/类
private String pluralizeIfNecessary(CPropertyInfo propertyInfo,
final String propertyName) {
return (propertyInfo.isCollection() && isUsePluralForm())? JJavaName
.getPluralForm(propertyName) : propertyName;
}