Package org.springframework.roo.model

Examples of org.springframework.roo.model.JavaType


    }

    @Override
    protected String getGovernorPhysicalTypeIdentifier(
            String metadataIdentificationString) {
        final JavaType javaType = PermissionEvaluatorMetadata
                .getJavaType(metadataIdentificationString);
        final LogicalPath path = PermissionEvaluatorMetadata
                .getPath(metadataIdentificationString);
        return PhysicalTypeIdentifier.createIdentifier(javaType, path);
    }
View Full Code Here


                .getMemberHoldingTypeDetails();
        if (permissionEvaluatorClass == null) {
            return null;
        }
       
        JavaType permissionEvaluatorInterface = null;

        for (final JavaType implementedType : permissionEvaluatorClass
                .getImplementsTypes()) {
            if (implementedType.equals(PERMISSION_EVALUATOR)) {
                permissionEvaluatorInterface = implementedType;
View Full Code Here

                "Compilation unit services required");
        Validate.notNull(typeDeclaration, "Type declaration required");

        // Convert the ClassOrInterfaceDeclaration name into a JavaType
        final NameExpr nameExpr = getNameExpr(typeDeclaration.getName());
        final JavaType effectiveType = getJavaType(compilationUnitServices,
                nameExpr, null);

        final List<JavaType> parameterTypes = new ArrayList<JavaType>();
        if (typeDeclaration instanceof ClassOrInterfaceDeclaration) {
            final ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) typeDeclaration;
            // Populate JavaType with type parameters
            final List<TypeParameter> typeParameters = clazz
                    .getTypeParameters();
            if (typeParameters != null) {
                final Set<JavaSymbolName> locatedTypeParameters = new HashSet<JavaSymbolName>();
                for (final TypeParameter candidate : typeParameters) {
                    final JavaSymbolName currentTypeParam = new JavaSymbolName(
                            candidate.getName());
                    locatedTypeParameters.add(currentTypeParam);
                    JavaType javaType = null;
                    if (candidate.getTypeBound() == null) {
                        javaType = new JavaType(
                                OBJECT.getFullyQualifiedTypeName(), 0,
                                DataType.TYPE, currentTypeParam, null);
                    }
                    else {
                        final ClassOrInterfaceType cit = candidate
                                .getTypeBound().get(0);
                        javaType = JavaParserUtils.getJavaTypeNow(
                                compilationUnitServices, cit,
                                locatedTypeParameters);
                        javaType = new JavaType(
                                javaType.getFullyQualifiedTypeName(),
                                javaType.getArray(), javaType.getDataType(),
                                currentTypeParam, javaType.getParameters());
                    }
                    parameterTypes.add(javaType);
                }
            }
        }

        return new JavaType(effectiveType.getFullyQualifiedTypeName(),
                effectiveType.getArray(), effectiveType.getDataType(), null,
                parameterTypes);
    }
View Full Code Here

            typeName = scope.getName() + "." + typeName;
            scope = scope.getScope();
        }
        final NameExpr nameExpr = getNameExpr(typeName);

        final JavaType effectiveType = getJavaType(compilationUnitServices,
                nameExpr, typeParameters);

        // Handle any type arguments
        final List<JavaType> parameterTypes = new ArrayList<JavaType>();
        if (cit.getTypeArgs() != null) {
            for (final Type ta : cit.getTypeArgs()) {
                parameterTypes.add(getJavaType(compilationUnitServices, ta,
                        typeParameters));
            }
        }

        return new JavaType(effectiveType.getFullyQualifiedTypeName(),
                effectiveType.getArray(), effectiveType.getDataType(), null,
                parameterTypes);
    }
View Full Code Here

                final String packageName = ((QualifiedNameExpr) scope)
                        .getQualifier().getName();
                final String simpleName = ((QualifiedNameExpr) scope).getName();
                final String fullyQualifiedName = packageName + "."
                        + simpleName;
                final JavaType javaType = new JavaType(fullyQualifiedName);
                final NameExpr nameToUse = importTypeIfRequired(targetType,
                        imports, javaType);
                if (!(nameToUse instanceof QualifiedNameExpr)) {
                    return new FieldAccessExpr(nameToUse, field);
                }
            }
        }
        else if (value instanceof ClassExpr) {
            final Type type = ((ClassExpr) value).getType();
            if (type instanceof ClassOrInterfaceType) {
                final JavaType javaType = new JavaType(
                        ((ClassOrInterfaceType) type).getName());
                final NameExpr nameToUse = importTypeIfRequired(targetType,
                        imports, javaType);
                if (!(nameToUse instanceof QualifiedNameExpr)) {
                    return new ClassExpr(new ClassOrInterfaceType(
                            javaType.getSimpleTypeName()));
                }
            }
            else if (type instanceof ReferenceType
                    && ((ReferenceType) type).getType() instanceof ClassOrInterfaceType) {
                final ClassOrInterfaceType cit = (ClassOrInterfaceType) ((ReferenceType) type)
                        .getType();
                final JavaType javaType = new JavaType(cit.getName());
                final NameExpr nameToUse = importTypeIfRequired(targetType,
                        imports, javaType);
                if (!(nameToUse instanceof QualifiedNameExpr)) {
                    return new ClassExpr(new ClassOrInterfaceType(
                            javaType.getSimpleTypeName()));
                }
            }
        }

        // Make no changes
View Full Code Here

        fieldType = JavaParserUtils.getJavaType(compilationUnitServices, type,
                typeParameters);

        // Convert into an array if this variable ID uses array notation
        if (var.getId().getArrayCount() > 0) {
            fieldType = new JavaType(fieldType.getFullyQualifiedTypeName(), var
                    .getId().getArrayCount() + fieldType.getArray(),
                    fieldType.getDataType(), fieldType.getArgName(),
                    fieldType.getParameters());
        }
View Full Code Here

        // Lookup the parameters and their names
        if (methodDeclaration.getParameters() != null) {
            for (final Parameter p : methodDeclaration.getParameters()) {
                final Type pt = p.getType();
                final JavaType parameterType = JavaParserUtils.getJavaType(
                        compilationUnitServices, pt, fullTypeParameters);
                final List<AnnotationExpr> annotationsList = p.getAnnotations();
                final List<AnnotationMetadata> annotations = new ArrayList<AnnotationMetadata>();
                if (annotationsList != null) {
                    for (final AnnotationExpr candidate : annotationsList) {
                        final AnnotationMetadata annotationMetadata = JavaParserAnnotationMetadataBuilder
                                .getInstance(candidate, compilationUnitServices)
                                .build();
                        annotations.add(annotationMetadata);
                    }
                }
                final AnnotatedJavaType param = new AnnotatedJavaType(
                        parameterType, annotations);
                param.setVarArgs(p.isVarArgs());
                parameterTypes.add(param);
                parameterNames.add(new JavaSymbolName(p.getId().getName()));
            }
        }

        if (methodDeclaration.getThrows() != null) {
            for (final NameExpr throwsType : methodDeclaration.getThrows()) {
                final JavaType throwing = JavaParserUtils
                        .getJavaType(compilationUnitServices, throwsType,
                                fullTypeParameters);
                throwsTypes.add(throwing);
            }
        }
View Full Code Here

            append(".");
            append(innerType.getName().getSimpleTypeName());
            if (innerType.getExtendsTypes().size() > 0) {
                append(" extends ");
                // There should only be one extends type for inner classes
                final JavaType extendsType = innerType.getExtendsTypes().get(0);
                if (resolver
                        .isFullyQualifiedFormRequiredAfterAutoImport(extendsType)) {
                    append(extendsType.getNameIncludingTypeParameters());
                }
                else {
                    append(extendsType.getNameIncludingTypeParameters(false,
                            resolver));
                }
                append(" ");
            }
            final List<JavaType> implementsTypes = innerType
                    .getImplementsTypes();
            if (implementsTypes.size() > 0) {
                append(" implements ");
                for (int i = 0; i < implementsTypes.size(); i++) {
                    final JavaType implementsType = implementsTypes.get(i);
                    if (resolver
                            .isFullyQualifiedFormRequiredAfterAutoImport(implementsType)) {
                        append(implementsType.getNameIncludingTypeParameters());
                    }
                    else {
                        append(implementsType.getNameIncludingTypeParameters(
                                false, resolver));
                    }
                    if (i != implementsTypes.size() - 1) {
                        append(", ");
                    }
View Full Code Here

        if (produceMetadata) {
            // This type contains an annotation we were configured to detect, or
            // there is an ITD (which may need deletion), so we need to produce
            // the metadata
            final JavaType aspectName = governorPhysicalTypeMetadata
                    .getItdJavaType(this);
            final ItdTypeDetailsProvidingMetadataItem metadata = getMetadata(
                    metadataIdentificationString, aspectName,
                    governorPhysicalTypeMetadata, itdFilename);
View Full Code Here

                        MetadataIdentificationUtils
                                .getMetadataClass(PhysicalTypeIdentifier
                                        .getMetadataIdentiferType())),
                "Expected a valid physical Java type instance identifier (not '%s')",
                physicalJavaTypeIdentifier);
        final JavaType javaType = PhysicalTypeIdentifier
                .getJavaType(physicalJavaTypeIdentifier);
        final LogicalPath path = PhysicalTypeIdentifier
                .getPath(physicalJavaTypeIdentifier);
        return createLocalIdentifier(javaType, path);
    }
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.