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


Java ModelBuilder类代码示例

本文整理汇总了Java中org.kuali.rice.core.api.mo.ModelBuilder的典型用法代码示例。如果您正苦于以下问题:Java ModelBuilder类的具体用法?Java ModelBuilder怎么用?Java ModelBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModelBuilder类属于org.kuali.rice.core.api.mo包,在下文中一共展示了ModelBuilder类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertFromBuilderList

import org.kuali.rice.core.api.mo.ModelBuilder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <B> List<B> convertFromBuilderList(List<? extends ModelBuilder> toConvert) {
	if (CollectionUtils.isEmpty(toConvert)) {
		return Collections.emptyList();
	} else {
		List<B> results = new ArrayList<B>(toConvert.size());
		for (ModelBuilder elem : toConvert) {
			results.add((B)elem.build());
		}
		return Collections.unmodifiableList(results);
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:BuilderUtils.java

示例2: convertFromBuilderSet

import org.kuali.rice.core.api.mo.ModelBuilder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <B> Set<B> convertFromBuilderSet(Set<? extends ModelBuilder> toConvert) {
	if (CollectionUtils.isEmpty(toConvert)) {
		return Collections.emptySet();
	} else {
		Set<B> results = new HashSet<B>(toConvert.size());
		for (ModelBuilder elem : toConvert) {
			results.add((B)elem.build());
		}
		return Collections.unmodifiableSet(results);
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:BuilderUtils.java

示例3: renderBuilderClass

import org.kuali.rice.core.api.mo.ModelBuilder; //导入依赖的package包/类
private void renderBuilderClass(JDefinedClass classModel, List<FieldModel> fields, Class<?> contractInterface) throws Exception {
	
	// define constants class
	JDefinedClass builderClass = classModel._class(JMod.PUBLIC | JMod.STATIC | JMod.FINAL, Util.BUILDER_CLASS_NAME);
	
	// create a literal version of the Builder class so that the code generator won't pre-pend Builder class references with outermost class
	JClass literalBuilderClass = codeModel.ref("Builder");
	
	// generate the javadoc on the top of the Elements class
	JDocComment javadoc = builderClass.javadoc();
	javadoc.append(Util.generateBuilderJavadoc(classModel.name(), contractInterface.getSimpleName()));
	
	builderClass._implements(contractInterface);
	builderClass._implements(ModelBuilder.class);
	builderClass._implements(Serializable.class);
	
	// render the builder fields
	for (FieldModel fieldModel : fields) {
		builderClass.field(JMod.PRIVATE, fieldModel.fieldType, fieldModel.fieldName);
	}
	
	// render default empty constructor for builder
	JMethod constructor = builderClass.constructor(JMod.PRIVATE);
	constructor.body().directStatement("// TODO modify this constructor as needed to pass any required values and invoke the appropriate 'setter' methods");

	renderBuilderDefaultCreate(builderClass, literalBuilderClass);
	renderBuilderCreateContract(builderClass, literalBuilderClass, fields, contractInterface);
	renderBuild(builderClass);
	renderGetters(builderClass, fields);
	renderSetters(builderClass, fields);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:ImmutableJaxbGenerator.java


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