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


Java ClassOrInterfaceTypeDetailsBuilder.addImplementsType方法代碼示例

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


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

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

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
private void createPermissionEvaluator(
        final JavaPackage permissionEvaluatorPackage) {
    installPermissionEvaluatorTemplate(permissionEvaluatorPackage);
    final LogicalPath focusedSrcMainJava = LogicalPath.getInstance(
            SRC_MAIN_JAVA, getProjectOperations().getFocusedModuleName());
    JavaType permissionEvaluatorClass = new JavaType(
            permissionEvaluatorPackage.getFullyQualifiedPackageName()
                    + ".ApplicationPermissionEvaluator");
    final String identifier = getPathResolver().getFocusedCanonicalPath(
            Path.SRC_MAIN_JAVA, permissionEvaluatorClass);
    if (getFileManager().exists(identifier)) {
        return; // Type already exists - nothing to do
    }

    final AnnotationMetadataBuilder classAnnotationMetadata = new AnnotationMetadataBuilder(
            ROO_PERMISSION_EVALUATOR);
    final String classMid = PhysicalTypeIdentifier.createIdentifier(
            permissionEvaluatorClass, getPathResolver().getPath(identifier));
    final ClassOrInterfaceTypeDetailsBuilder classBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            classMid, PUBLIC, permissionEvaluatorClass, CLASS);
    classBuilder.addAnnotation(classAnnotationMetadata.build());
    classBuilder.addImplementsType(PERMISSION_EVALUATOR);
    getTypeManagementService().createOrUpdateTypeOnDisk(classBuilder.build());

    getMetadataService().get(PermissionEvaluatorMetadata.createIdentifier(
            permissionEvaluatorClass, focusedSrcMainJava));
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:28,代碼來源:SecurityOperationsImpl.java

示例4: createConverter

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
private void createConverter(final JavaPackage javaPackage,
        final JavaType entity) {
	
	if(pathResolver == null){
		pathResolver = getPathResolver();
	}
	Validate.notNull(pathResolver, "PathResolver is required");
	
	if(shell == null){
		shell = getShell();
	}
	Validate.notNull(shell, "Shell is required");
	
	if(typeManagementService == null){
		typeManagementService = getTypeManagementService();
	}
	Validate.notNull(typeManagementService, "TypeManagementService is required");
	
	// Create type annotation for new converter class
    final JavaType converterType = new JavaType(
            javaPackage.getFullyQualifiedPackageName() + "."
                    + entity.getSimpleTypeName() + "Converter");
    final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
            ROO_JSF_CONVERTER);
    annotationBuilder.addClassAttribute("entity", entity);
    final String declaredByMetadataId = PhysicalTypeIdentifier
            .createIdentifier(converterType,
                    pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA));
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            declaredByMetadataId, Modifier.PUBLIC, converterType,
            PhysicalTypeCategory.CLASS);
    cidBuilder.addAnnotation(annotationBuilder);
    cidBuilder.addImplementsType(JsfJavaType.CONVERTER);

    typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());

    shell.flash(Level.FINE,
            "Created " + converterType.getFullyQualifiedTypeName(),
            JsfOperationsImpl.class.getName());
    shell.flash(Level.FINE, "", JsfOperationsImpl.class.getName());
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:42,代碼來源:JsfOperationsImpl.java

示例5: generatePasswordHandler

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
/**
 * This method generates the file PasswordHandler.java with the annotation
 * <code>@GvNIXPasswordHandlerSAFE</code>
 * 
 */
public void generatePasswordHandler(JavaPackage targetPackage) {
    JavaType entity = new JavaType(String.format("%s.PasswordHandler",
            targetPackage.getFullyQualifiedPackageName()));

    Validate.notNull(entity, "Entity required");

    int modifier = Modifier.PUBLIC;

    final String declaredByMetadataId = PhysicalTypeIdentifier
            .createIdentifier(entity,
                    pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA));

    File targetFile = new File(
            typeLocationService
                    .getPhysicalTypeCanonicalPath(declaredByMetadataId));
    Validate.isTrue(!targetFile.exists(), "Type '%s' already exists",
            entity);

    // Prepare class builder
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            declaredByMetadataId, modifier, entity,
            PhysicalTypeCategory.CLASS);

    // Prepare annotations array
    List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(
            1);

    // Add @GvNIXPasswordHandlerSAFE annotation
    AnnotationMetadataBuilder gvnixPasswordHandlerAnnotation = new AnnotationMetadataBuilder(
            new JavaType(GvNIXPasswordHandlerSAFE.class));
    annotations.add(gvnixPasswordHandlerAnnotation);

    // Add Implements Type
    cidBuilder.addImplementsType(new JavaType(
            "javax.security.auth.callback.CallbackHandler"));

    // Set annotations
    cidBuilder.setAnnotations(annotations);

    typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());

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

示例6: generateSafeUser

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
/**
 * This method generates the file SafeUser.java with the annotation
 * <code>@GvNIXUserSAFE</code>
 * 
 */
public void generateSafeUser(JavaPackage targetPackage) {
    JavaType entity = new JavaType(String.format("%s.SafeUser",
            targetPackage.getFullyQualifiedPackageName()));

    Validate.notNull(entity, "Entity required");

    int modifier = Modifier.PUBLIC;

    final String declaredByMetadataId = PhysicalTypeIdentifier
            .createIdentifier(entity,
                    pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA));

    File targetFile = new File(
            typeLocationService
                    .getPhysicalTypeCanonicalPath(declaredByMetadataId));
    Validate.isTrue(!targetFile.exists(), "Type '%s' already exists",
            entity);

    // Prepare class builder
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            declaredByMetadataId, modifier, entity,
            PhysicalTypeCategory.CLASS);

    // Prepare annotations array
    List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(
            2);

    // Add @GvNIXUserSAFE annotation
    AnnotationMetadataBuilder gvnixUserSafeAnnotation = new AnnotationMetadataBuilder(
            new JavaType(GvNIXUserSAFE.class));
    annotations.add(gvnixUserSafeAnnotation);

    // Add @RooJavaBean annotation
    AnnotationMetadataBuilder javaBeanAnnotation = new AnnotationMetadataBuilder(
            new JavaType(
                    "org.springframework.roo.addon.javabean.RooJavaBean"));
    annotations.add(javaBeanAnnotation);

    // Add Implements Type
    cidBuilder.addImplementsType(new JavaType(
            "org.springframework.security.core.userdetails.UserDetails"));
    cidBuilder.addImplementsType(new JavaType("java.io.Serializable"));

    // Set annotations
    cidBuilder.setAnnotations(annotations);

    typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());

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

示例7: generateSafeUserAuthority

import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder; //導入方法依賴的package包/類
/**
 * This method generates the file SafeUserAuthority.java with the annotation
 * <code>@GvNIXUserAuthoritySAFE</code>
 * 
 */
public void generateSafeUserAuthority(JavaPackage targetPackage) {
    JavaType entity = new JavaType(String.format("%s.SafeUserAuthority",
            targetPackage.getFullyQualifiedPackageName()));

    Validate.notNull(entity, "Entity required");

    int modifier = Modifier.PUBLIC;

    final String declaredByMetadataId = PhysicalTypeIdentifier
            .createIdentifier(entity,
                    pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA));

    File targetFile = new File(
            typeLocationService
                    .getPhysicalTypeCanonicalPath(declaredByMetadataId));
    Validate.isTrue(!targetFile.exists(), "Type '%s' already exists",
            entity);

    // Prepare class builder
    final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            declaredByMetadataId, modifier, entity,
            PhysicalTypeCategory.CLASS);

    // Prepare annotations array
    List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(
            2);

    // Add @GvNIXUserAuthoritySAFE annotation
    AnnotationMetadataBuilder gvNIXUserAuthSafeAnn = new AnnotationMetadataBuilder(
            new JavaType(GvNIXUserAuthoritySAFE.class));
    annotations.add(gvNIXUserAuthSafeAnn);

    // Add @RooJavaBean annotation
    AnnotationMetadataBuilder javaBeanAnnotation = new AnnotationMetadataBuilder(
            new JavaType(
                    "org.springframework.roo.addon.javabean.RooJavaBean"));
    annotations.add(javaBeanAnnotation);

    // Add Implements Type
    cidBuilder.addImplementsType(new JavaType(
            "org.springframework.security.core.GrantedAuthority"));
    cidBuilder.addImplementsType(new JavaType("java.io.Serializable"));

    // Set annotations
    cidBuilder.setAnnotations(annotations);

    typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());

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


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