本文整理汇总了Java中org.springframework.roo.classpath.details.FieldMetadata.getCustomData方法的典型用法代码示例。如果您正苦于以下问题:Java FieldMetadata.getCustomData方法的具体用法?Java FieldMetadata.getCustomData怎么用?Java FieldMetadata.getCustomData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.roo.classpath.details.FieldMetadata
的用法示例。
在下文中一共展示了FieldMetadata.getCustomData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResetMethod
import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private MethodMetadataBuilder getResetMethod() {
final JavaSymbolName methodName = new JavaSymbolName("reset");
if (governorHasMethod(methodName)) {
return null;
}
final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
bodyBuilder.appendFormalLine(entityName.getSymbolName() + " = null;");
for (final FieldMetadata field : locatedFields) {
final CustomData customData = field.getCustomData();
if (!customData.keySet().contains(PARAMETER_TYPE_KEY)) {
continue;
}
bodyBuilder.appendFormalLine(getSelectedFieldName(field
.getFieldName().getSymbolName()) + " = null;");
}
bodyBuilder.appendFormalLine(CREATE_DIALOG_VISIBLE + " = false;");
return getMethod(PUBLIC, methodName, VOID_PRIMITIVE, null, null,
bodyBuilder);
}
示例2: getOnEditMethod
import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private MethodMetadataBuilder getOnEditMethod() {
final JavaSymbolName methodName = new JavaSymbolName("onEdit");
if (governorHasMethod(methodName)) {
return null;
}
final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
for (final FieldMetadata field : locatedFields) {
final CustomData customData = field.getCustomData();
if (!customData.keySet().contains(PARAMETER_TYPE_KEY)) {
continue;
}
builder.getImportRegistrationResolver().addImport(ARRAY_LIST);
final String fieldName = field.getFieldName().getSymbolName();
final JavaType parameterType = (JavaType) customData
.get(PARAMETER_TYPE_KEY);
final String entityAccessorMethodCall = entityName.getSymbolName()
+ ".get" + StringUtils.capitalize(fieldName) + "()";
bodyBuilder
.appendFormalLine("if (" + entityName.getSymbolName()
+ " != null && " + entityAccessorMethodCall
+ " != null) {");
bodyBuilder.indent();
bodyBuilder.appendFormalLine(getSelectedFieldName(fieldName)
+ " = new ArrayList<" + parameterType.getSimpleTypeName()
+ ">(" + entityAccessorMethodCall + ");");
bodyBuilder.indentRemove();
bodyBuilder.appendFormalLine("}");
}
bodyBuilder.appendFormalLine("return null;");
return new MethodMetadataBuilder(getId(), PUBLIC, methodName,
JavaType.STRING, new ArrayList<AnnotatedJavaType>(),
new ArrayList<JavaSymbolName>(), bodyBuilder);
}