Examples of PhysicalTypeMetadata


Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

        Validate.notNull(type, "Specify the type to focus on");
        final String physicalTypeIdentifier = typeLocationService
                .getPhysicalTypeIdentifier(type);
        Validate.notNull(physicalTypeIdentifier, "Cannot locate the type %s",
                type.getFullyQualifiedTypeName());
        final PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) metadataService
                .get(physicalTypeIdentifier);
        Validate.notNull(ptm, "Class %s does not exist",
                PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier));
    }
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

            if (physicalTypeCategory == PhysicalTypeCategory.CLASS
                    && extendsTypes.size() == 1) {
                final JavaType superclass = extendsTypes.get(0);
                final String superclassId = typeLocationService
                        .getPhysicalTypeIdentifier(superclass);
                PhysicalTypeMetadata superPtm = null;
                if (superclassId != null) {
                    superPtm = (PhysicalTypeMetadata) metadataService
                            .get(superclassId);
                }
                if (superPtm != null
                        && superPtm.getMemberHoldingTypeDetails() != null) {
                    cidBuilder.setSuperclass(superPtm
                            .getMemberHoldingTypeDetails());
                }
            }

            implementsList = clazz.getImplements();
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

        // Compute the identifier for the Physical Type Metadata we're
        // correlated with
        final String governorPhysicalTypeIdentifier = getGovernorPhysicalTypeIdentifier(metadataIdentificationString);

        // Obtain the physical type
        final PhysicalTypeMetadata governorPhysicalTypeMetadata = (PhysicalTypeMetadata) metadataService
                .get(governorPhysicalTypeIdentifier);
        if (governorPhysicalTypeMetadata == null
                || !governorPhysicalTypeMetadata.isValid()) {
            // We can't get even basic information about the physical type, so
            // abort (the ITD will be deleted by ItdFileDeletionService)
            return null;
        }

        // Flag to indicate whether we'll even try to create this metadata
        boolean produceMetadata = false;

        // Determine if we should generate the metadata on the basis of it
        // containing a trigger annotation
        final ClassOrInterfaceTypeDetails cid = governorPhysicalTypeMetadata
                .getMemberHoldingTypeDetails();
        if (cid != null) {
            // Only create metadata if the type is annotated with one of the
            // metadata triggers
            for (final JavaType trigger : metadataTriggers) {
                if (cid.getAnnotation(trigger) != null) {
                    produceMetadata = true;
                    break;
                }
            }
        }

        // Fall back to ignoring trigger annotations
        if (ignoreTriggerAnnotations) {
            produceMetadata = true;
        }

        // Cancel production if the governor type details are required, but
        // aren't available
        if (dependsOnGovernorTypeDetailAvailability && cid == null) {
            produceMetadata = false;
        }

        // Cancel production if the governor is not a class, and the subclass
        // only wants to know about classes
        if (cid != null && dependsOnGovernorBeingAClass
                && cid.getPhysicalTypeCategory() != PhysicalTypeCategory.CLASS) {
            produceMetadata = false;
        }

        final String itdFilename = governorPhysicalTypeMetadata
                .getItdCanonicalPath(this);
        if (!produceMetadata && isGovernor(cid)
                && fileManager.exists(itdFilename)) {
            // We don't seem to want metadata anymore, yet the ITD physically
            // exists, so get rid of it
            // This might be because the trigger annotation has been removed,
            // the governor is missing a class declaration, etc.
            deleteItd(metadataIdentificationString, itdFilename,
                    "not required for governor " + cid.getName(), true);
            return null;
        }

        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

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

                .getPhysicalTypeIdentifier(type);
        if (physicalTypeIdentifier == null) {
            return null;
        }
        // We need to lookup the metadata we depend on
        final PhysicalTypeMetadata physicalTypeMetadata = (PhysicalTypeMetadata) metadataService
                .get(physicalTypeIdentifier);
        return getMemberDetails(physicalTypeMetadata);
    }
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

            if (physicalTypeCategory == PhysicalTypeCategory.CLASS
                    && extendsTypes.size() == 1) {
                final JavaType superclass = extendsTypes.get(0);
                final String superclassId = typeLocationService
                        .getPhysicalTypeIdentifier(superclass);
                PhysicalTypeMetadata superPtm = null;
                if (superclassId != null) {
                    superPtm = (PhysicalTypeMetadata) metadataService
                            .get(superclassId);
                }
                if (superPtm != null
                        && superPtm.getMemberHoldingTypeDetails() != null) {
                    cidBuilder.setSuperclass(superPtm
                            .getMemberHoldingTypeDetails());
                }
            }

            implementsList = clazz.getImplements();
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

    private ClassOrInterfaceTypeDetails getEntitySuperclass(
            final JavaType entity) {
        final String physicalTypeIdentifier = PhysicalTypeIdentifier
                .createIdentifier(entity,
                        typeLocationService.getTypePath(entity));
        final PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) metadataService
                .get(physicalTypeIdentifier);
        Validate.notNull(ptm, "Java source code unavailable for type %s",
                PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier));
        final PhysicalTypeDetails ptd = ptm.getMemberHoldingTypeDetails();
        Validate.notNull(ptd,
                "Java source code details unavailable for type %s",
                PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier));
        Validate.isInstanceOf(ClassOrInterfaceTypeDetails.class, ptd,
                "Java source code is immutable for type %s",
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

    @Reference private MetadataService metadataService;

    public ServiceAnnotationValues getInstance(
            final ClassOrInterfaceTypeDetails serviceInterface) {
        final PhysicalTypeMetadata physicalTypeMetadata = (PhysicalTypeMetadata) metadataService
                .get(serviceInterface.getDeclaredByMetadataId());
        if (physicalTypeMetadata == null) {
            return null;
        }
        return new ServiceAnnotationValues(physicalTypeMetadata);
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

        Validate.notNull(javaTypeDetails,
                "The type specified, '%s', doesn't exist", typeName);

        final String physicalTypeIdentifier = javaTypeDetails
                .getDeclaredByMetadataId();
        final PhysicalTypeMetadata targetTypeMetadata = (PhysicalTypeMetadata) metadataService
                .get(physicalTypeIdentifier);
        Validate.notNull(
                targetTypeMetadata,
                "The specified target '--class' does not exist or can not be found. Please create this type first.");
        final PhysicalTypeDetails targetPtd = targetTypeMetadata
                .getMemberHoldingTypeDetails();
        Validate.isInstanceOf(MemberHoldingTypeDetails.class, targetPtd);

        final ClassOrInterfaceTypeDetails targetTypeCid = (ClassOrInterfaceTypeDetails) targetPtd;
        final MemberDetails memberDetails = memberDetailsScanner
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

     *
     * @param javaType the type to be deleted (required)
     * @param reason the reason for deletion (can be blank)
     */
    private void deleteJavaType(final JavaType javaType, final String reason) {
        final PhysicalTypeMetadata governorPhysicalTypeMetadata = getPhysicalTypeMetadata(javaType);
        if (governorPhysicalTypeMetadata != null) {
            final String filePath = governorPhysicalTypeMetadata
                    .getPhysicalLocationCanonicalPath();
            if (fileManager.exists(filePath)) {
                fileManager.delete(filePath, reason);
                shell.flash(Level.FINE,
                        "Deleted " + javaType.getFullyQualifiedTypeName(),
View Full Code Here

Examples of org.springframework.roo.classpath.PhysicalTypeMetadata

     *
     * @param entity the entity for which to get the ID type (required)
     * @return a non-<code>null</code> ID type
     */
    private JavaType getIdentifierType(final JavaType entity) {
        final PhysicalTypeMetadata governorPhysicalTypeMetadata = getPhysicalTypeMetadata(entity);
        if (governorPhysicalTypeMetadata != null) {
            final ClassOrInterfaceTypeDetails governorTypeDetails = governorPhysicalTypeMetadata
                    .getMemberHoldingTypeDetails();
            final AnnotationMetadata jpaAnnotation = getJpaAnnotation(governorTypeDetails);
            if (jpaAnnotation != null) {
                final AnnotationAttributeValue<?> identifierTypeAttribute = jpaAnnotation
                        .getAttribute(new JavaSymbolName(IDENTIFIER_TYPE));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.