Package org.springframework.roo.model

Examples of org.springframework.roo.model.JavaType


        final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService
                .getTypeFromString(fileContents, SIMPLE_CLASS_DECLARED_BY_MID,
                        SIMPLE_CLASS_TYPE);

        final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
                new JavaType(
                        "org.springframework.roo.addon.tostring.RooToString"));
        final ClassOrInterfaceTypeDetails newSimpleInterfaceDetails = addAnnotation(
                simpleInterfaceDetails, annotationBuilder.build());

        // Invoke
View Full Code Here


    }

    @Test
    public void testGetTypeFromStringWhenFileContainsNoSuchType() {
        // Set up
        final JavaType mockTargetType = mock(JavaType.class);
        when(mockTargetType.getSimpleTypeName()).thenReturn("NoSuchType");

        // Invoke
        final ClassOrInterfaceTypeDetails locatedType = typeParsingService
                .getTypeFromString(SOURCE_FILE, DECLARED_BY_MID, mockTargetType);
View Full Code Here

    }

    @Test
    public void testGetTypeFromStringWhenFileContainsNoTypes() {
        // Set up
        final JavaType mockTargetType = mock(JavaType.class);

        // Invoke
        final ClassOrInterfaceTypeDetails locatedType = typeParsingService
                .getTypeFromString(EMPTY_FILE, DECLARED_BY_MID, mockTargetType);
View Full Code Here

    @Test
    public void testGetTypeFromStringWhenFileContainsThatType()
            throws Exception {
        // Set up
        final JavaType mockTargetType = mock(JavaType.class);
        final TypeDeclaration mockTypeDeclaration = mock(TypeDeclaration.class);
        final ClassOrInterfaceTypeDetails mockClassOrInterfaceTypeDetails = mock(ClassOrInterfaceTypeDetails.class);
        final JavaParserClassOrInterfaceTypeDetailsBuilder mockBuilder = mock(JavaParserClassOrInterfaceTypeDetailsBuilder.class);
        when(mockBuilder.build()).thenReturn(mockClassOrInterfaceTypeDetails);
View Full Code Here

        final HashSet<String> imported = new HashSet<String>();
        final ArrayList<ImportDeclaration> imports = new ArrayList<ImportDeclaration>();
        for (final ImportDeclaration importDeclaration : compilationUnit
                .getImports()) {
            JavaPackage importPackage = null;
            JavaType importType = null;
            if (importDeclaration.isAsterisk()) {
                importPackage = new JavaPackage(importDeclaration.getName()
                        .toString());
            }
            else {
                importType = new JavaType(importDeclaration.getName()
                        .toString());
                importPackage = importType.getPackage();
            }

            if (importPackage.equals(cid.getName().getPackage())
                    && importDeclaration.isAsterisk()) {
                continue;
            }

            if (importPackage.equals(cid.getName().getPackage())
                    && importType != null
                    && importType.getEnclosingType() == null) {
                continue;
            }

            if (importType != null && importType.equals(cid.getName())) {
                continue;
            }

            if (!imported.contains(importDeclaration.getName().toString())) {
                imports.add(importDeclaration);
View Full Code Here

        Validate.notNull(annotationValues, "Annotation values required");
        Validate.notNull(identifierType, "Id type required");

        // Make the user's Repository interface extend Spring Data's
        // JpaRepository interface if it doesn't already
        ensureGovernorExtends(new JavaType(SPRING_JPA_REPOSITORY, 0,
                DataType.TYPE, null, Arrays.asList(
                        annotationValues.getDomainType(), identifierType)));

        // ... and likewise extend JpaSpecificationExecutor<Foo>, to allow query
        // by specification
        ensureGovernorExtends(new JavaType(SPRING_JPA_SPECIFICATION_EXECUTOR,
                0, DataType.TYPE, null, Arrays.asList(annotationValues
                        .getDomainType())));

        builder.addAnnotation(new AnnotationMetadataBuilder(
                SpringJavaType.REPOSITORY));
View Full Code Here

                .getTypeFromString(fileContents, SIMPLE_CLASS_DECLARED_BY_MID,
                        SIMPLE_CLASS_TYPE);

        final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                SIMPLE_CLASS_DECLARED_BY_MID, Modifier.PRIVATE,
                new JavaSymbolName("newFieldAddedByCode"), new JavaType(
                        String.class), "\"Create by code\"");
        final ClassOrInterfaceTypeDetails newSimpleInterfaceDetails = addField(
                simpleInterfaceDetails, fieldBuilder.build());

        // Invoke
View Full Code Here

        final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService
                .getTypeFromString(fileContents, SIMPLE_CLASS_DECLARED_BY_MID,
                        SIMPLE_CLASS_TYPE);

        final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
                new JavaType(
                        "org.springframework.roo.addon.tostring.RooToString"));
        final ClassOrInterfaceTypeDetails newSimpleInterfaceDetails = addAnnotation(
                simpleInterfaceDetails, annotationBuilder.build());

        // Invoke
View Full Code Here

     * Returns the <code>equals</code> method to be generated
     *
     * @return <code>null</code> if no generation is required
     */
    private MethodMetadataBuilder getEqualsMethod() {
        final JavaType parameterType = OBJECT;
        if (governorHasMethod(EQUALS_METHOD_NAME, parameterType)) {
            return null;
        }

        final List<JavaSymbolName> parameterNames = Arrays
View Full Code Here

            String role, boolean usePermissionEvaluator,
            boolean useXmlConfiguration) {
        for (final ClassOrInterfaceTypeDetails domainType : typeLocationService
                .findClassesOrInterfaceDetailsWithAnnotation(ROO_JPA_ENTITY,
                        ROO_JPA_ACTIVE_RECORD)) {
            JavaType interfaceType = new JavaType(
                    interfacePackage.getFullyQualifiedPackageName() + "."
                            + domainType.getName().getSimpleTypeName()
                            + "Service");
            JavaType classType = new JavaType(
                    classPackage.getFullyQualifiedPackageName() + "."
                            + domainType.getName().getSimpleTypeName()
                            + "ServiceImpl");
            setupService(interfaceType, classType, domainType.getName(),
                    requireAuthentication, role, usePermissionEvaluator,
View Full Code Here

TOP

Related Classes of org.springframework.roo.model.JavaType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.