Package org.springframework.roo.classpath.details.annotations

Examples of org.springframework.roo.classpath.details.annotations.AnnotationMetadata


    private boolean isEmbeddable(final ClassOrInterfaceTypeDetails ptmd) {
        if (ptmd == null) {
            return false;
        }
        final AnnotationMetadata annotationMetadata = ptmd
                .getAnnotation(EMBEDDABLE);
        return annotationMetadata != null;
    }
View Full Code Here


        return lookupXFromEntity(entity, RooJavaType.ROO_GWT_PROXY);
    }

    public ClassOrInterfaceTypeDetails lookupProxyFromRequest(
            final ClassOrInterfaceTypeDetails request) {
        final AnnotationMetadata annotation = GwtUtils.getFirstAnnotation(
                request, RooJavaType.ROO_GWT_REQUEST);
        Validate.notNull(annotation, "Request '%s' isn't annotated with '%s'",
                request.getName(), RooJavaType.ROO_GWT_REQUEST);
        final AnnotationAttributeValue<?> attributeValue = annotation
                .getAttribute("value");
        final JavaType proxyType = new JavaType(
                GwtUtils.getStringValue(attributeValue));
        return lookupProxyFromEntity(typeLocationService
                .getTypeDetails(proxyType));
View Full Code Here

        return lookupXFromEntity(entity, RooJavaType.ROO_GWT_REQUEST);
    }

    public ClassOrInterfaceTypeDetails lookupRequestFromProxy(
            final ClassOrInterfaceTypeDetails proxy) {
        final AnnotationMetadata annotation = GwtUtils.getFirstAnnotation(
                proxy, RooJavaType.ROO_GWT_PROXY);
        Validate.notNull(annotation, "Proxy '%s' isn't annotated with '%s'",
                proxy.getName(), RooJavaType.ROO_GWT_PROXY);
        final AnnotationAttributeValue<?> attributeValue = annotation
                .getAttribute("value");
        final JavaType serviceNameType = new JavaType(
                GwtUtils.getStringValue(attributeValue));
        return lookupRequestFromEntity(typeLocationService
                .getTypeDetails(serviceNameType));
View Full Code Here

                .getTypeDetails(serviceNameType));
    }

    public ClassOrInterfaceTypeDetails lookupUnmanagedRequestFromProxy(
            final ClassOrInterfaceTypeDetails proxy) {
        final AnnotationMetadata annotation = GwtUtils.getFirstAnnotation(
                proxy, RooJavaType.ROO_GWT_PROXY);
        Validate.notNull(annotation, "Proxy '%s' isn't annotated with '%s'",
                proxy.getName(), RooJavaType.ROO_GWT_PROXY);
        final AnnotationAttributeValue<?> attributeValue = annotation
                .getAttribute("value");
        final JavaType serviceNameType = new JavaType(
                GwtUtils.getStringValue(attributeValue));
        return lookupUnmanagedRequestFromEntity(typeLocationService
                .getTypeDetails(serviceNameType));
View Full Code Here

    }

    public ClassOrInterfaceTypeDetails lookupTargetFromX(
            final ClassOrInterfaceTypeDetails annotatedType,
            final JavaType... annotations) {
        final AnnotationMetadata annotation = GwtUtils.getFirstAnnotation(
                annotatedType, annotations);
        Validate.notNull(annotation,
                "Type '" + annotatedType.getName() + "' isn't annotated with '"
                        + StringUtils.join(Arrays.asList(annotations), ",")
                        + "'");
        final AnnotationAttributeValue<?> attributeValue = annotation
                .getAttribute("value");
        final JavaType targetType = new JavaType(
                GwtUtils.getStringValue(attributeValue));
        return typeLocationService.getTypeDetails(targetType);
    }
View Full Code Here

        }

        // We know there should be an existing RooEntity annotation
        final List<? extends AnnotationMetadata> annotations = cid
                .getAnnotations();
        final AnnotationMetadata jpaActiveRecordAnnotation = MemberFindingUtils
                .getAnnotationOfType(annotations, ROO_JPA_ACTIVE_RECORD);
        if (jpaActiveRecordAnnotation == null) {
            LOGGER.warning("Unable to find the entity annotation on '"
                    + typeName.getFullyQualifiedTypeName() + "'");
            return;
        }

        // Confirm they typed a valid finder name
        final MemberDetails memberDetails = memberDetailsScanner
                .getMemberDetails(getClass().getName(), cid);
        if (dynamicFinderServices.getQueryHolder(memberDetails, finderName,
                jpaActiveRecordMetadata.getPlural(),
                jpaActiveRecordMetadata.getEntityName()) == null) {
            LOGGER.warning("Finder name '" + finderName.getSymbolName()
                    + "' either does not exist or contains an error");
            return;
        }

        // Make a destination list to store our final attributes
        final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>();
        final List<StringAttributeValue> desiredFinders = new ArrayList<StringAttributeValue>();

        // Copy the existing attributes, excluding the "finder" attribute
        boolean alreadyAdded = false;
        final AnnotationAttributeValue<?> val = jpaActiveRecordAnnotation
                .getAttribute(new JavaSymbolName("finders"));
        if (val != null) {
            // Ensure we have an array of strings
            if (!(val instanceof ArrayAttributeValue<?>)) {
                LOGGER.warning(getErrorMsg());
View Full Code Here

            final ClassOrInterfaceTypeDetails entity,
            final JavaType... annotations) {
        Validate.notNull(entity, "Entity not found");
        for (final ClassOrInterfaceTypeDetails cid : typeLocationService
                .findClassesOrInterfaceDetailsWithAnnotation(annotations)) {
            final AnnotationMetadata annotationMetadata = GwtUtils
                    .getFirstAnnotation(cid, annotations);
            if (annotationMetadata != null) {
                final AnnotationAttributeValue<?> attributeValue = annotationMetadata
                        .getAttribute("value");
                final String value = GwtUtils.getStringValue(attributeValue);
                if (entity.getName().getFullyQualifiedTypeName().equals(value)) {
                    return cid;
                }
View Full Code Here

            createUnmanagedRequestInterface(entity, destinationPackage);
        }
    }

    private void createScaffold(final ClassOrInterfaceTypeDetails proxy) {
        final AnnotationMetadata annotationMetadata = GwtUtils
                .getFirstAnnotation(proxy, ROO_GWT_PROXY);
        if (annotationMetadata != null) {
            final AnnotationAttributeValue<Boolean> booleanAttributeValue = annotationMetadata
                    .getAttribute("scaffold");
            if (booleanAttributeValue == null
                    || !booleanAttributeValue.getValue()) {
                final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                        proxy);
                final AnnotationMetadataBuilder annotationMetadataBuilder = new AnnotationMetadataBuilder(
                        annotationMetadata);
                annotationMetadataBuilder.addBooleanAttribute("scaffold", true);
                for (final AnnotationMetadataBuilder existingAnnotation : cidBuilder
                        .getAnnotations()) {
                    if (existingAnnotation.getAnnotationType().equals(
                            annotationMetadata.getAnnotationType())) {
                        cidBuilder.getAnnotations().remove(existingAnnotation);
                        cidBuilder.getAnnotations().add(
                                annotationMetadataBuilder);
                        break;
                    }
View Full Code Here

                .findClassesOrInterfaceDetailsWithAnnotation(ROO_GWT_MIRRORED_FROM)) {
            final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                    proxyOrRequest);
            if (proxyOrRequest.extendsType(ENTITY_PROXY)
                    || proxyOrRequest.extendsType(OLD_ENTITY_PROXY)) {
                final AnnotationMetadata annotationMetadata = MemberFindingUtils
                        .getAnnotationOfType(proxyOrRequest.getAnnotations(),
                                ROO_GWT_MIRRORED_FROM);
                if (annotationMetadata != null) {
                    final AnnotationMetadataBuilder annotationMetadataBuilder = new AnnotationMetadataBuilder(
                            annotationMetadata);
                    annotationMetadataBuilder.setAnnotationType(ROO_GWT_PROXY);
                    cidBuilder.removeAnnotation(ROO_GWT_MIRRORED_FROM);
                    cidBuilder.addAnnotation(annotationMetadataBuilder);
                    typeManagementService.createOrUpdateTypeOnDisk(cidBuilder
                            .build());
                }
            }
            else if (proxyOrRequest.extendsType(REQUEST_CONTEXT)
                    || proxyOrRequest.extendsType(OLD_REQUEST_CONTEXT)) {
                final AnnotationMetadata annotationMetadata = MemberFindingUtils
                        .getAnnotationOfType(proxyOrRequest.getAnnotations(),
                                ROO_GWT_MIRRORED_FROM);
                if (annotationMetadata != null) {
                    final AnnotationMetadataBuilder annotationMetadataBuilder = new AnnotationMetadataBuilder(
                            annotationMetadata);
View Full Code Here

        final ClassOrInterfaceTypeDetails proxy = getGovernor(metadataIdentificationString);
        if (proxy == null) {
            return null;
        }

        final AnnotationMetadata proxyAnnotation = GwtUtils.getFirstAnnotation(
                proxy, GwtUtils.PROXY_ANNOTATIONS);
        if (proxyAnnotation == null) {
            return null;
        }

        final String locatorType = GwtUtils.getStringValue(proxyAnnotation
                .getAttribute("locator"));
        if (StringUtils.isBlank(locatorType)) {
            return null;
        }

        final ClassOrInterfaceTypeDetails entityType = gwtTypeService
                .lookupEntityFromProxy(proxy);
        if (entityType == null || Modifier.isAbstract(entityType.getModifier())) {
            return null;
        }

        boolean useXmlConfiguration = false;
        final ClassOrInterfaceTypeDetails existingLocator = gwtTypeService
                .lookupLocatorFromEntity(entityType);
        if (existingLocator != null) {
            AnnotationMetadata annotation = existingLocator
                    .getAnnotation(RooJavaType.ROO_GWT_LOCATOR);
            AnnotationAttributeValue<Boolean> attribute = annotation
                    .getAttribute("useXmlConfiguration");
            if (attribute != null)
                useXmlConfiguration = attribute.getValue();
        }
View Full Code Here

TOP

Related Classes of org.springframework.roo.classpath.details.annotations.AnnotationMetadata

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.