protected AbstractAnnotationValues(final MemberHoldingTypeDetails memberHoldingTypeDetails, final JavaType annotationType) { Validate.notNull(annotationType, "Annotation to locate is required"); if (memberHoldingTypeDetails instanceof ClassOrInterfaceTypeDetails) { classParsed = true; // We have reliable physical type details governorTypeDetails = (ClassOrInterfaceTypeDetails) memberHoldingTypeDetails; // Process values from the annotation, if present annotationMetadata = governorTypeDetails.getAnnotation(annotationType); } }
@Override public boolean isValid(JavaType javaType) { ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); if (cid.getAnnotation(RooJavaType.ROO_JPA_ENTITY) != null || cid.getAnnotation(JpaJavaType.ENTITY) != null) { return true; } return false; }
@Override public boolean isValid(JavaType javaType) { ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); if (cid.getAnnotation(RooJavaType.ROO_DTO) != null) { return true; } return false; }
@Override public boolean isValid(JavaType javaType) { ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); return cid.getAnnotation(RooJavaType.ROO_JPA_ENTITY) != null; }
@Override public boolean isValid(JavaType javaType) { ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); if (cid.getAnnotation(RooJavaType.ROO_THYMELEAF) != null) { return true; } return false; }
@Override public boolean isValid(JavaType javaType) { ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); if (cid.getAnnotation(RooJavaType.ROO_REPOSITORY_JPA) != null) { return true; } return false; }
@Override public boolean isValid(JavaType javaType) { ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); if (cid.getAnnotation(RooJavaType.ROO_JSON) != null) { return true; } return false; }
@Override public boolean isValid(JavaType javaType) { ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); if (cid.getAnnotation(RooJavaType.ROO_JPA_ENTITY) != null) { return true; } return false; }
@Override public Collection<ClassOrInterfaceTypeDetails> getControllers(JavaType domainType, ControllerType type, JavaType viewType) { final Collection<ClassOrInterfaceTypeDetails> found = getControllers(domainType, type); if (found.isEmpty()) { return found; } Collection<ClassOrInterfaceTypeDetails> result = new HashSet<ClassOrInterfaceTypeDetails>(); for (ClassOrInterfaceTypeDetails item : found) { AnnotationMetadata annotation = item.getAnnotation(viewType); if (annotation == null) { continue; } result.add(item); } return result; }
private boolean isExceptionAnnotatedWithResponseStatus(JavaType exception) { ClassOrInterfaceTypeDetails exceptionCid = typeLocationService.getTypeDetails(exception); Validate.notNull(exceptionCid, String.format("Can't found class: %s", exception.getFullyQualifiedTypeName())); AnnotationMetadata annotation = exceptionCid.getAnnotation(SpringJavaType.RESPONSE_STATUS); if (annotation == null) { return false; } return true; }
/** * Ensures that the governor is annotated with the given annotation * * @param AnnotationMetadataBuilder the annotation to use(required) * @since 2.0 */ protected final void ensureGovernorIsAnnotated(final AnnotationMetadataBuilder annotationMetadata) { if (governorTypeDetails.getAnnotation(annotationMetadata.getAnnotationType()) == null) { builder.addAnnotation(annotationMetadata); } }
private AnnotationMetadata getEmbeddableAnnotation() { if (governorTypeDetails.getAnnotation(EMBEDDABLE) != null) { return null; } final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(EMBEDDABLE); return annotationBuilder.build(); }
@Override public boolean isValid(JavaType javaType) { ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); MemberDetails details = memberDetailsScanner.getMemberDetails(this.getClass().getName(), cid); if (cid.getAnnotation(JpaJavaType.EMBEDDABLE) != null || details.getAnnotation(JpaJavaType.EMBEDDABLE) != null) { return true; } return false; }
private boolean typeIsEntity(JavaType type) { return typeLocationService.getTypeDetails(type) != null && typeLocationService.getTypeDetails(type).getAnnotation(RooJavaType.ROO_JPA_ENTITY) != null; }
/** * Returns the metadata for an annotation of the given type if the governor * does not already have one. * * @param annotationType the type of annotation to generate (required) * @return <code>null</code> if the governor already has that annotation */ protected AnnotationMetadata getTypeAnnotation(final JavaType annotationType) { if (governorTypeDetails.getAnnotation(annotationType) != null) { return null; } return new AnnotationMetadataBuilder(annotationType).build(); }
@Override public JavaType getEntityFactory(JavaType entity) { Set<ClassOrInterfaceTypeDetails> dataOnDemandCids = typeLocationService .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_JPA_ENTITY_FACTORY); JavaType typeToReturn = null; for (ClassOrInterfaceTypeDetails cid : dataOnDemandCids) { if (entity.equals((JavaType) cid.getAnnotation(RooJavaType.ROO_JPA_ENTITY_FACTORY) .getAttribute("entity").getValue())) { typeToReturn = cid.getName(); break; } } return typeToReturn; }
@Override protected void onAddAnnotation(final AnnotationMetadataBuilder md) { Validate.isTrue(governor.getAnnotation(md.getAnnotationType()) == null, "Type annotation '%s' already defined in target type '%s' (ITD target '%s')", md.getAnnotationType(), governor.getName().getFullyQualifiedTypeName(), aspect.getFullyQualifiedTypeName()); Validate.isTrue(build().getAnnotation(md.getAnnotationType()) == null, "Type annotation '%s' already defined in ITD (ITD target '%s')", md.getAnnotationType(), aspect.getFullyQualifiedTypeName()); }
@Override public JavaType getDataOnDemand(JavaType entity) { Set<ClassOrInterfaceTypeDetails> dataOnDemandCids = typeLocationService .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_JPA_DATA_ON_DEMAND); JavaType typeToReturn = null; for (ClassOrInterfaceTypeDetails cid : dataOnDemandCids) { if (entity.equals((JavaType) cid.getAnnotation(RooJavaType.ROO_JPA_DATA_ON_DEMAND) .getAttribute("entity").getValue())) { typeToReturn = cid.getName(); break; } } return typeToReturn; }
private JavaType getEntityDeserializerFor(JavaType entity) { Set<ClassOrInterfaceTypeDetails> deserializers = getTypeLocationService().findClassesOrInterfaceDetailsWithAnnotation( RooJavaType.ROO_DESERIALIZER); for (ClassOrInterfaceTypeDetails deserializer : deserializers) { AnnotationMetadata annotation = deserializer.getAnnotation(RooJavaType.ROO_DESERIALIZER); AnnotationAttributeValue<JavaType> annotationValue = annotation.getAttribute("entity"); if (entity.equals(annotationValue.getValue())) { return deserializer.getType(); } } return null; }
private String getEntityFactoryMetadataId(final JavaType javaType, final Iterable<ClassOrInterfaceTypeDetails> entityFactoryTypes) { for (final ClassOrInterfaceTypeDetails cid : entityFactoryTypes) { final AnnotationMetadata entityFactoryAnnotation = cid.getAnnotation(ROO_JPA_ENTITY_FACTORY); final AnnotationAttributeValue<JavaType> entityAttribute = entityFactoryAnnotation.getAttribute("entity"); if (entityAttribute != null && entityAttribute.getValue().equals(javaType)) { // Found the DoD type for the given field's type return JpaDataOnDemandMetadata.createIdentifier(cid.getName(), PhysicalTypeIdentifier.getPath(cid.getDeclaredByMetadataId())); } } return null; }