當前位置: 首頁>>代碼示例>>Java>>正文


Java ClassOrInterfaceTypeDetailsBuilder.build方法代碼示例

本文整理匯總了Java中org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder.build方法的典型用法代碼示例。如果您正苦於以下問題:Java ClassOrInterfaceTypeDetailsBuilder.build方法的具體用法?Java ClassOrInterfaceTypeDetailsBuilder.build怎麽用?Java ClassOrInterfaceTypeDetailsBuilder.build使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder的用法示例。


在下文中一共展示了ClassOrInterfaceTypeDetailsBuilder.build方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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();
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:26,代碼來源:Op4jMetadata.java

示例2: 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();
    }
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:23,代碼來源:EnversRevisionLogEntityMetadataBuilder.java

示例3: getListInnerClass

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
/**
 * Gets Inner class to manage elements list for batch operations
 * 
 * @return
 */
public ClassOrInterfaceTypeDetails getListInnerClass() {
    // Generate inner class name
    JavaType listInnerClassJavaType = new JavaType(destination
            .getSimpleTypeName().concat("List"), 0, DataType.TYPE, null,
            null);

    // Create class builder
    ClassOrInterfaceTypeDetailsBuilder classBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            getId(), Modifier.STATIC | Modifier.PUBLIC,
            listInnerClassJavaType, PhysicalTypeCategory.CLASS);

    // Add fields
    FieldMetadata listField = getListInner_field("list", destination)
            .build();
    FieldMetadata selectedField = getListInner_field("selected",
            new JavaType("Integer")).build();
    classBuilder.addField(listField);
    classBuilder.addField(selectedField);

    // Adds getter/setter for list field
    classBuilder.addMethod(getListInner_getter(listField));
    classBuilder.addMethod(getListInner_setter(listField));

    // Adds getter/setter for selected field
    classBuilder.addMethod(getListInner_getter(selectedField));
    classBuilder.addMethod(getListInner_setter(selectedField));

    // Return generated class
    return classBuilder.build();
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:36,代碼來源:EntityBatchMetadata.java

示例4: addField

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
public static ClassOrInterfaceTypeDetails addField(
        final ClassOrInterfaceTypeDetails ptd, final FieldMetadata field) {
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            ptd);
    cidBuilder.addField(field);
    return cidBuilder.build();
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:8,代碼來源:UpdateCompilationUnitTest.java

示例5: addAnnotation

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
public static ClassOrInterfaceTypeDetails addAnnotation(
        final ClassOrInterfaceTypeDetails ptd,
        final AnnotationMetadata annotation) {
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            ptd);
    cidBuilder.addAnnotation(annotation);
    return cidBuilder.build();
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:9,代碼來源:UpdateCompilationUnitTest.java

示例6: build

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
public MemberHoldingTypeDetails build() {
    if (existing instanceof ItdTypeDetails) {
        final ItdTypeDetailsBuilder itdBuilder = new ItdTypeDetailsBuilder(
                (ItdTypeDetails) existing);
        // Push in all members that may have been modified
        itdBuilder.setDeclaredFields(getDeclaredFields());
        itdBuilder.setDeclaredMethods(getDeclaredMethods());
        itdBuilder.setAnnotations(getAnnotations());
        itdBuilder.setCustomData(getCustomData());
        itdBuilder.setDeclaredConstructors(getDeclaredConstructors());
        itdBuilder.setDeclaredInitializers(getDeclaredInitializers());
        itdBuilder.setDeclaredInnerTypes(getDeclaredInnerTypes());
        itdBuilder.setExtendsTypes(getExtendsTypes());
        itdBuilder.setImplementsTypes(getImplementsTypes());
        itdBuilder.setModifier(getModifier());
        return itdBuilder.build();
    }
    else if (existing instanceof ClassOrInterfaceTypeDetails) {
        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                (ClassOrInterfaceTypeDetails) existing);
        // Push in all members that may
        cidBuilder.setDeclaredFields(getDeclaredFields());
        cidBuilder.setDeclaredMethods(getDeclaredMethods());
        cidBuilder.setAnnotations(getAnnotations());
        cidBuilder.setCustomData(getCustomData());
        cidBuilder.setDeclaredConstructors(getDeclaredConstructors());
        cidBuilder.setDeclaredInitializers(getDeclaredInitializers());
        cidBuilder.setDeclaredInnerTypes(getDeclaredInnerTypes());
        cidBuilder.setExtendsTypes(getExtendsTypes());
        cidBuilder.setImplementsTypes(getImplementsTypes());
        cidBuilder.setModifier(getModifier());
        return cidBuilder.build();
    }
    else {
        throw new IllegalStateException(
                "Unknown instance of MemberHoldingTypeDetails");
    }
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:39,代碼來源:MemberDetailsBuilder.java

示例7: getRevisionClass

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
/**
 * @return revision item class definition
 */
private ClassOrInterfaceTypeDetails getRevisionClass() {

    // Check class exists
    ClassOrInterfaceTypeDetails innerClass = governorTypeDetails
            .getDeclaredInnerType(revisonItemType);

    if (innerClass != null) {
        // If class exists (already pushed-in) we can do nothing
        return innerClass;
    }

    // Create class builder for inner class
    ClassOrInterfaceTypeDetailsBuilder classBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            getId(), Modifier.PUBLIC + Modifier.STATIC, revisonItemType,
            PhysicalTypeCategory.CLASS);

    // Add revisionLog-provider required artifacts
    revisionLogBuilder.addCustomArtifactToRevisionItem(classBuilder);

    // Add Revision item common methods
    classBuilder.addMethod(createRevisionItemGetItemMethod());
    classBuilder.addMethod(createRevisionItemGetRevisionNumberMethod());
    classBuilder.addMethod(createRevisionItemGetRevisionUserMethod());
    classBuilder.addMethod(createRevisionItemGetRevisionDateMethod());
    classBuilder.addMethod(createRevisionItemIsCreateMethod());
    classBuilder.addMethod(createRevisionItemIsUpdateMethod());
    classBuilder.addMethod(createRevisionItemIsDeleteMethod());
    classBuilder.addMethod(createRevisionItemGetTypeMethod());

    // Build class definition from builder
    return classBuilder.build();
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:36,代碼來源:JpaAuditMetadata.java

示例8: createNewManagedEntityFromTable

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
/**
 * Creates a new DBRE-managed entity from the given table
 * 
 * @param javaType the name of the entity to be created (required)
 * @param table the table from which to create the entity (required)
 * @param activeRecord whether to create "active record" CRUD methods in the
 *            new entity
 * @return the newly created entity
 */
private ClassOrInterfaceTypeDetails createNewManagedEntityFromTable(
        final JavaType javaType, final Table table,
        final boolean activeRecord) {
    // Create type annotations for new entity
    final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
    annotations.add(new AnnotationMetadataBuilder(ROO_JAVA_BEAN));
    annotations.add(new AnnotationMetadataBuilder(ROO_TO_STRING));

    // Find primary key from db metadata and add identifier attributes to
    // @RooJpaEntity
    final AnnotationMetadataBuilder jpaAnnotationBuilder = new AnnotationMetadataBuilder(
            activeRecord ? ROO_JPA_ACTIVE_RECORD : ROO_JPA_ENTITY);
    manageIdentifier(javaType, jpaAnnotationBuilder,
            new HashSet<JavaSymbolName>(), table);

    if (!hasVersionField(table)) {
        jpaAnnotationBuilder.addStringAttribute(VERSION_FIELD, "");
    }
    if (table.isDisableGeneratedIdentifiers()) {
        jpaAnnotationBuilder.addStringAttribute(SEQUENCE_NAME_FIELD, "");
    }

    jpaAnnotationBuilder.addStringAttribute("table", table.getName());
    if (!DbreModelService.NO_SCHEMA_REQUIRED.equals(table.getSchema()
            .getName())) {
        jpaAnnotationBuilder.addStringAttribute("schema", table.getSchema()
                .getName());
    }

    annotations.add(jpaAnnotationBuilder);

    // Add @RooDbManaged
    annotations.add(getRooDbManagedAnnotation());

    final JavaType superclass = OBJECT;
    final List<JavaType> extendsTypes = new ArrayList<JavaType>();
    extendsTypes.add(superclass);

    // Create entity class
    final String declaredByMetadataId = PhysicalTypeIdentifier
            .createIdentifier(javaType, projectOperations.getPathResolver()
                    .getFocusedPath(Path.SRC_MAIN_JAVA));
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            declaredByMetadataId, Modifier.PUBLIC, javaType,
            PhysicalTypeCategory.CLASS);
    cidBuilder.setExtendsTypes(extendsTypes);
    cidBuilder.setAnnotations(annotations);

    final ClassOrInterfaceTypeDetails entity = cidBuilder.build();
    typeManagementService.createOrUpdateTypeOnDisk(entity);

    shell.flash(Level.FINE,
            "Created " + javaType.getFullyQualifiedTypeName(),
            DbreDatabaseListenerImpl.class.getName());
    shell.flash(Level.FINE, "", DbreDatabaseListenerImpl.class.getName());

    return entity;
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:68,代碼來源:DbreDatabaseListenerImpl.java

示例9: createRemotingDestination

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
public void createRemotingDestination(JavaType service, JavaType entity) {
    Validate.notNull(service, "Remoting Destination Java Type required");
    Validate.notNull(entity, "Entity Java Type required");

    String resourceIdentifier = this.typeLocationService
            .getPhysicalTypeCanonicalPath(service,
                    LogicalPath.getInstance(Path.SRC_MAIN_JAVA, ""));

    // create annotation @RooFlexScaffold
    List<AnnotationAttributeValue<?>> rooFlexScaffoldAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    rooFlexScaffoldAttributes.add(new ClassAttributeValue(
            new JavaSymbolName("entity"), entity));
    AnnotationMetadata atRooFlexScaffold = new AnnotationMetadataBuilder(
            new JavaType(RooFlexScaffold.class.getName()),
            rooFlexScaffoldAttributes).build();

    // create annotation @RemotingDestination
    List<AnnotationAttributeValue<?>> remotingDestinationAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    AnnotationMetadata atRemotingDestination = new AnnotationMetadataBuilder(
            new JavaType(
                    "org.springframework.flex.remoting.RemotingDestination"),
            remotingDestinationAttributes).build();

    // create annotation @Service
    List<AnnotationAttributeValue<?>> serviceAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    AnnotationMetadata atService = new AnnotationMetadataBuilder(
            new JavaType("org.springframework.stereotype.Service"),
            serviceAttributes).build();

    String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(
            service, getPathResolver().getPath(resourceIdentifier));
    ClassOrInterfaceTypeDetailsBuilder typeBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            declaredByMetadataId, Modifier.PUBLIC, service,
            PhysicalTypeCategory.CLASS);
    typeBuilder.addAnnotation(atRooFlexScaffold);
    typeBuilder.addAnnotation(atRemotingDestination);
    typeBuilder.addAnnotation(atService);
    ClassOrInterfaceTypeDetails details = typeBuilder.build();

    this.typeManagementService.generateClassFile(details);

    ActionScriptType asType = ActionScriptMappingUtils
            .toActionScriptType(entity);

    // Trigger creation of corresponding ActionScript entities
    this.metadataService.get(ActionScriptEntityMetadata
            .createTypeIdentifier(asType, "src/main/flex"));
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:49,代碼來源:FlexOperationsImpl.java

示例10: testEnumAddElement

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
@Test
public void testEnumAddElement() throws Exception {

    // Set up
    final File file = getResource(ENUM_FILE_PATH);
    final String fileContents = getResourceContents(file);
    final String filePath = file.getCanonicalPath();

    final ClassOrInterfaceTypeDetails enumDetails = typeParsingService
            .getTypeFromString(fileContents, ENUM_DECLARED_BY_MID,
                    ENUM_TYPE);

    // Invoke
    final String result = typeParsingService
            .updateAndGetCompilationUnitContents(filePath, enumDetails);

    saveResult(file, result);

    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            enumDetails);

    cidBuilder.addEnumConstant(new JavaSymbolName("ALIEN"));

    final ClassOrInterfaceTypeDetails enumDetails2 = cidBuilder.build();

    // Invoke
    final String result2 = typeParsingService
            .updateAndGetCompilationUnitContents(filePath, enumDetails2);

    saveResult(file, result2, "addedConst");

    checkEnum(result2);

    assertTrue(result2.contains("MALE, FEMALE, ALIEN"));

}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:37,代碼來源:NewUpdateCompilationUnitTest.java


注:本文中的org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder.build方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。