本文整理匯總了Java中org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java ClassOrInterfaceTypeDetailsBuilder類的具體用法?Java ClassOrInterfaceTypeDetailsBuilder怎麽用?Java ClassOrInterfaceTypeDetailsBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ClassOrInterfaceTypeDetailsBuilder類屬於org.springframework.roo.classpath.details包,在下文中一共展示了ClassOrInterfaceTypeDetailsBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: annotateTypeWithGvNIXEntityBatch
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
/**
* Annotates with GvNIXEntityBatch given JavaType
*
* @param type
*/
private void annotateTypeWithGvNIXEntityBatch(JavaType type) {
ClassOrInterfaceTypeDetails typeMutableDetails = typeLocationService
.getTypeDetails(type);
AnnotationMetadata annotationMetadata = MemberFindingUtils
.getAnnotationOfType(typeMutableDetails.getAnnotations(),
ENTITYBATCH_ANNOTATION);
// Annotate type with GvNIXEntityBatch just if is not
// annotated already. We don't need to update attributes
if (annotationMetadata == null) {
// Prepare annotation builder
AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
ENTITYBATCH_ANNOTATION);
ClassOrInterfaceTypeDetailsBuilder mutableTypeDetailsBuilder = new ClassOrInterfaceTypeDetailsBuilder(
typeMutableDetails);
mutableTypeDetailsBuilder.addAnnotation(annotationBuilder.build());
typeManagementService
.createOrUpdateTypeOnDisk(mutableTypeDetailsBuilder.build());
}
}
示例2: annotateGeoEntityController
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
/**
* This method annotates controller with @GvNIXEntityMapLayer
*
* @param controller
* @param path
*/
public void annotateGeoEntityController(JavaType controller, String path) {
ClassOrInterfaceTypeDetails controllerDetails = getTypeLocationService()
.getTypeDetails(controller);
// Generating annotation
ClassOrInterfaceTypeDetailsBuilder detailsBuilder = new ClassOrInterfaceTypeDetailsBuilder(
controllerDetails);
AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
GVNIX_WEB_ENTITY_MAP_LAYER_ANNOTATION);
// Add annotation to target type
detailsBuilder.updateTypeAnnotation(annotationBuilder.build());
// Save changes to disk
getTypeManagementService().createOrUpdateTypeOnDisk(
detailsBuilder.build());
}
示例3: annotateType
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
public void annotateType(final JavaType javaType) {
Validate.notNull(javaType, "Java type required");
final ClassOrInterfaceTypeDetails cid = typeLocationService
.getTypeDetails(javaType);
if (cid == null) {
throw new IllegalArgumentException("Cannot locate source for '"
+ javaType.getFullyQualifiedTypeName() + "'");
}
if (MemberFindingUtils.getAnnotationOfType(cid.getAnnotations(),
ROO_OP4J) == null) {
final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
ROO_OP4J);
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
cid);
cidBuilder.addAnnotation(annotationBuilder);
typeManagementService.createOrUpdateTypeOnDisk(cid);
}
}
示例4: getInnerType
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
private ClassOrInterfaceTypeDetails getInnerType() {
final List<FieldMetadataBuilder> fields = new ArrayList<FieldMetadataBuilder>();
builder.getImportRegistrationResolver().addImports(OP4J_GET,
JAVA_RUN_TYPE_TYPES);
final String targetName = super.destination.getSimpleTypeName();
final String initializer = "Get.attrOf(Types.forClass(" + targetName
+ ".class),\"" + targetName.toLowerCase() + "\")";
final List<JavaType> parameters = Arrays.asList(OBJECT, destination);
final JavaType function = new JavaType("org.op4j.functions.Function",
0, DataType.TYPE, null, parameters);
final int fieldModifier = Modifier.PUBLIC | Modifier.STATIC
| Modifier.FINAL;
final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
getId(), fieldModifier, new JavaSymbolName(
targetName.toUpperCase()), function, initializer);
fields.add(fieldBuilder);
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
getId(), Modifier.PUBLIC | Modifier.STATIC, KEYS,
PhysicalTypeCategory.CLASS);
cidBuilder.setDeclaredFields(fields);
return cidBuilder.build();
}
示例5: getMethodAdditions
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
/**
* Returns the additions that the caller needs to make in order to invoke
* the given method
*
* @param callerMID the caller's metadata ID (required)
* @param method the method being called (required)
* @param repositoryType the type of repository being called
* @param parameterNames the parameter names used by the caller
* @return a non-<code>null</code> set of additions
*/
private MemberTypeAdditions getMethodAdditions(final String callerMID,
final RepositoryJpaLayerMethod method,
final JavaType repositoryType,
final List<MethodParameter> parameters) {
// Create a builder to hold the repository field to be copied into the
// caller
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
callerMID);
final AnnotationMetadataBuilder autowiredAnnotation = new AnnotationMetadataBuilder(
AUTOWIRED);
final String repositoryFieldName = StringUtils
.uncapitalize(repositoryType.getSimpleTypeName());
cidBuilder.addField(new FieldMetadataBuilder(callerMID, 0, Arrays
.asList(autowiredAnnotation), new JavaSymbolName(
repositoryFieldName), repositoryType));
// Create the additions to invoke the given method on this field
final String methodCall = repositoryFieldName + "."
+ method.getCall(parameters);
return new MemberTypeAdditions(cidBuilder, method.getName(),
methodCall, false, parameters);
}
示例6: createIdentifierClass
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
private void createIdentifierClass(final JavaType identifierType) {
final List<AnnotationMetadataBuilder> identifierAnnotations = new ArrayList<AnnotationMetadataBuilder>();
final AnnotationMetadataBuilder identifierBuilder = new AnnotationMetadataBuilder(
ROO_IDENTIFIER);
identifierBuilder.addBooleanAttribute(DB_MANAGED.getSymbolName(), true);
identifierAnnotations.add(identifierBuilder);
// Produce identifier itself
final String declaredByMetadataId = PhysicalTypeIdentifier
.createIdentifier(identifierType, projectOperations
.getPathResolver().getFocusedPath(Path.SRC_MAIN_JAVA));
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
declaredByMetadataId, Modifier.PUBLIC | Modifier.FINAL,
identifierType, PhysicalTypeCategory.CLASS);
cidBuilder.setAnnotations(identifierAnnotations);
typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
shell.flash(Level.FINE,
"Created " + identifierType.getFullyQualifiedTypeName(),
DbreDatabaseListenerImpl.class.getName());
shell.flash(Level.FINE, "", DbreDatabaseListenerImpl.class.getName());
}
示例7: getMethodAdditions
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
/**
* Returns the additions that the caller needs to make in order to invoke
* the given method
*
* @param callerMID the caller's metadata ID (required)
* @param method the method being called (required)
* @param repositoryType the type of repository being called
* @param parameterNames the parameter names used by the caller
* @return a non-<code>null</code> set of additions
*/
private MemberTypeAdditions getMethodAdditions(final String callerMID,
final RepositoryMongoLayerMethod method,
final JavaType repositoryType,
final List<MethodParameter> parameters) {
// Create a builder to hold the repository field to be copied into the
// caller
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
callerMID);
final AnnotationMetadataBuilder autowiredAnnotation = new AnnotationMetadataBuilder(
AUTOWIRED);
final String repositoryFieldName = StringUtils
.uncapitalize(repositoryType.getSimpleTypeName());
cidBuilder.addField(new FieldMetadataBuilder(callerMID, 0, Arrays
.asList(autowiredAnnotation), new JavaSymbolName(
repositoryFieldName), repositoryType));
// Create the additions to invoke the given method on this field
final String methodCall = repositoryFieldName + "."
+ method.getCall(parameters);
return new MemberTypeAdditions(cidBuilder, method.getName(),
methodCall, false, parameters);
}
示例8: createServiceClass
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
private void createServiceClass(final JavaType interfaceType,
final JavaType classType) {
Validate.notNull(classType, "Class type required");
final String classIdentifier = pathResolver.getFocusedCanonicalPath(
Path.SRC_MAIN_JAVA, classType);
if (fileManager.exists(classIdentifier)) {
return; // Type already exists - nothing to do
}
final String classMid = PhysicalTypeIdentifier.createIdentifier(
classType, pathResolver.getPath(classIdentifier));
final ClassOrInterfaceTypeDetailsBuilder classTypeBuilder = new ClassOrInterfaceTypeDetailsBuilder(
classMid, PUBLIC, classType, CLASS);
classTypeBuilder.addImplementsType(interfaceType);
typeManagementService
.createOrUpdateTypeOnDisk(classTypeBuilder.build());
}
示例9: appendToExistingType
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
private void appendToExistingType(final JavaType type,
final JavaType jsonEntity) {
final ClassOrInterfaceTypeDetails cid = typeLocationService
.getTypeDetails(type);
if (cid == null) {
throw new IllegalArgumentException("Cannot locate source for '"
+ type.getFullyQualifiedTypeName() + "'");
}
if (MemberFindingUtils.getAnnotationOfType(cid.getAnnotations(),
RooJavaType.ROO_WEB_JSON) != null) {
return;
}
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
cid);
cidBuilder.addAnnotation(getAnnotation(jsonEntity));
typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
}
示例10: createNewType
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
private void createNewType(final JavaType type, final JavaType jsonEntity) {
final PluralMetadata pluralMetadata = (PluralMetadata) metadataService
.get(PluralMetadata.createIdentifier(jsonEntity,
typeLocationService.getTypePath(jsonEntity)));
if (pluralMetadata == null) {
return;
}
final String declaredByMetadataId = PhysicalTypeIdentifier
.createIdentifier(type,
pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA));
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
declaredByMetadataId, Modifier.PUBLIC, type,
PhysicalTypeCategory.CLASS);
cidBuilder.addAnnotation(getAnnotation(jsonEntity));
cidBuilder.addAnnotation(new AnnotationMetadataBuilder(
SpringJavaType.CONTROLLER));
final AnnotationMetadataBuilder requestMapping = new AnnotationMetadataBuilder(
SpringJavaType.REQUEST_MAPPING);
requestMapping.addAttribute(new StringAttributeValue(
new JavaSymbolName("value"), "/"
+ pluralMetadata.getPlural().toLowerCase()));
cidBuilder.addAnnotation(requestMapping);
typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
}
示例11: addClass
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
/**
* Add a class to be monitored as a Spring service
*
* @param name Set the class name to be monitored
*/
@Override
public void addClass(JavaType name) {
// Get java type controller
ClassOrInterfaceTypeDetails controller = getControllerDetails(name);
// Generating new annotation
ClassOrInterfaceTypeDetailsBuilder builder = new ClassOrInterfaceTypeDetailsBuilder(
controller);
AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
SPRING_MONITORING_ANNOTATION);
// Add annotation to target type
builder.updateTypeAnnotation(annotationBuilder.build());
// Save changes to disk
getTypeManagementService().createOrUpdateTypeOnDisk(builder.build());
}
示例12: getRevisionListener
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
private ClassOrInterfaceTypeDetails getRevisionListener() {
// Check class exists
ClassOrInterfaceTypeDetails innerClass = governorTypeDetails
.getDeclaredInnerType(revisionListenerType);
if (innerClass != null) {
// If class exists (already push-in) we can do nothing
return innerClass;
}
// Create inner class
ClassOrInterfaceTypeDetailsBuilder classBuilder = new ClassOrInterfaceTypeDetailsBuilder(
context.getMetadataId(), Modifier.PUBLIC + Modifier.STATIC,
revisionListenerType, PhysicalTypeCategory.CLASS);
classBuilder.addImplementsType(REVISION_LISTENER);
classBuilder.addMethod(getNewRevisionMethod());
return classBuilder.build();
}
示例13: createServiceClass
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
/**
* {@inheritDoc}
* <p>
* Adds @org.springframework.stereotype.Service annotation to the class.
* </p>
*/
public void createServiceClass(JavaType serviceClass) {
// Service class
String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(
serviceClass, LogicalPath.getInstance(Path.SRC_MAIN_JAVA, ""));
// Service annotations
List<AnnotationMetadata> serviceAnnotations = new ArrayList<AnnotationMetadata>();
serviceAnnotations.add(new AnnotationMetadataBuilder(new JavaType(
"org.springframework.stereotype.Service"),
new ArrayList<AnnotationAttributeValue<?>>()).build());
ClassOrInterfaceTypeDetailsBuilder serviceDetails = new ClassOrInterfaceTypeDetailsBuilder(
declaredByMetadataId, Modifier.PUBLIC, serviceClass,
PhysicalTypeCategory.CLASS);
for (AnnotationMetadata annotationMetadata : serviceAnnotations) {
serviceDetails.addAnnotation(annotationMetadata);
}
typeManagementService.createOrUpdateTypeOnDisk(serviceDetails.build());
}
示例14: createType
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
/** {@inheritDoc} */
public void createType(JavaType classType) {
// Use Roo's Assert type for null checks
Validate.notNull(classType, "Class type required");
final String classIdentifier = typeLocationService.getPhysicalTypeCanonicalPath(classType,
pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA));
if (fileManager.exists(classIdentifier)) {
return; // Type exists already - nothing to do
}
final String classMdId = PhysicalTypeIdentifier.createIdentifier(classType, pathResolver.getPath(classIdentifier));
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
classMdId, Modifier.PUBLIC, classType, PhysicalTypeCategory.CLASS);
// Make this type a java bean and a toString() implementor.
cidBuilder.addAnnotation(new AnnotationMetadataBuilder(RooJavaType.ROO_JAVA_BEAN));
cidBuilder.addAnnotation(new AnnotationMetadataBuilder(RooJavaType.ROO_TO_STRING));
final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>();
cidBuilder.addAnnotation(new AnnotationMetadataBuilder(new JavaType(RooElasticsearchEntity.class), attributes));
typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
}
開發者ID:lbroudoux,項目名稱:spring-roo-addon-layers-repository-elasticsearch,代碼行數:25,代碼來源:ElasticsearchOperationsImpl.java
示例15: getMethodAdditions
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入依賴的package包/類
/**
* Returns the additions that the caller needs to make in order to invoke the given method.
* @param callerMID the caller's metadata ID (required)
* @param method the method being called (required)
* @param repositoryType the type of repository being called
* @param parameterNames the parameter names used by the caller
* @return a non-<code>null</code> set of additions
*/
private MemberTypeAdditions getMethodAdditions(final String callerMID, final RepositoryElasticsearchLayerMethod method,
final JavaType repositoryType, final List<MethodParameter> parameters) {
// Create a builder to hold the repository field to be copied into the caller.
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(callerMID);
final AnnotationMetadataBuilder autowiredAnnotation = new AnnotationMetadataBuilder(AUTOWIRED);
final String repositoryFieldName = StringUtils.uncapitalize(repositoryType.getSimpleTypeName());
cidBuilder.addField(new FieldMetadataBuilder(callerMID, 0, Arrays
.asList(autowiredAnnotation), new JavaSymbolName(
repositoryFieldName), repositoryType));
// Create the additions to invoke the given method on this field
final String methodCall = repositoryFieldName + "." + method.getCall(parameters, repositoryFieldName);
return new MemberTypeAdditions(cidBuilder, method.getName(),
methodCall, false, parameters);
}
開發者ID:lbroudoux,項目名稱:spring-roo-addon-layers-repository-elasticsearch,代碼行數:24,代碼來源:RepositoryElasticsearchLayerProvider.java