当前位置: 首页>>代码示例>>Java>>正文


Java CPropertyInfo.isCollection方法代码示例

本文整理汇总了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);
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:21,代码来源:PMMLPlugin.java

示例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;

}
 
开发者ID:massfords,项目名称:jaxb-visitor,代码行数:37,代码来源:ClassDiscoverer.java

示例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;
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:6,代码来源:SimplifyPlugin.java


注:本文中的com.sun.tools.xjc.model.CPropertyInfo.isCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。