@Override public AnnotationMetadata build() { final AnnotationMetadataBuilder annotationMetadataBuilder = new AnnotationMetadataBuilder(annotationType, attributeValues); final AnnotationMetadata md = annotationMetadataBuilder.build(); md.setCommentStructure(commentStructure); return md; }
/** * Gets `mappedBy` attribute value from JPA relationship annotation * * @param jpaAnnotation * @return */ private String getMappedByValue(AnnotationMetadata jpaAnnotation) { AnnotationAttributeValue<?> mappedByValue = jpaAnnotation.getAttribute(MAPPEDBY_ATTRIBUTE); if (mappedByValue == null) { return null; } return ((StringAttributeValue) mappedByValue).getValue(); }
/** * Builds @EntityListeners annotation * * @return AnnotationMetadataBuilder with the prepared annotation */ private AnnotationMetadataBuilder getEntityListenersAnnotation() { AnnotationMetadataBuilder annotation = new AnnotationMetadataBuilder(JpaJavaType.ENTITY_LISTENERS); annotation.addClassAttribute("value", SpringJavaType.AUDITING_ENTITY_LISTENER); return annotation; }
/** * Returns the metadata for the existing annotation, with no attribute * values * * @param annotationType the fully-qualified name of the annotation type * (required) * @return a non-<code>null</code> instance * @since 1.2.0 */ public static AnnotationMetadata getInstance(final String annotationType) { return new AnnotationMetadataBuilder(annotationType).build(); }
/** * Builds and returns @SpringletsWebMvcTest annotation * * @return {@link AnnotationMetadataBuilder} */ private AnnotationMetadataBuilder getSpringletsWebMvcAnnotation() { AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(SpringletsJavaType.SPRINGLETS_WEB_MVC_TEST); annotationBuilder.addClassAttribute("controllers", this.controller); annotationBuilder.addBooleanAttribute("secure", false); return annotationBuilder; }
/** * Builds and returns `@DataJpaTest` annotation * * @return {@link AnnotationMetadataBuilder} */ private AnnotationMetadataBuilder getDataJpaTestAnnotation() { AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(SpringJavaType.DATA_JPA_TEST); return annotationBuilder; }
/** * Adds an attribute with the given {@link JavaType} as its value * * @param key the attribute name (required) * @param javaType the value (required) */ public void addClassAttribute(final String key, final JavaType javaType) { addAttribute(new ClassAttributeValue(new JavaSymbolName(key), javaType)); }
private <T> T getAttributeValue(AnnotationAttributeValue attributeValue) { if (attributeValue == null) { return null; } return (T) attributeValue.getValue(); }
/** * Constructor that accepts an optional list of values * * @param annotationType * @param attributeValues can be <code>null</code> */ public AnnotationMetadataBuilder(final JavaType annotationType, final Collection<AnnotationAttributeValue<?>> attributeValues) { this.annotationType = annotationType; setAttributes(attributeValues); }
@Override public String toString() { return getName() + " -> " + value; } }
@Override public String toString() { return getName() + " -> " + value; } }
@Override public String toString() { return getName() + " -> " + value; } }
@Override public String toString() { return getName() + " -> " + value; } }
@Override public String toString() { return getName() + " -> " + value; } }
/** * Builds and returns `@RunWith` annotation * * @return {@link AnnotationMetadataBuilder} */ private AnnotationMetadataBuilder getRunWithAnnotation() { AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(RUN_WITH); annotationBuilder.addClassAttribute("value", SpringJavaType.SPRING_RUNNER); return annotationBuilder; }
/** * Returns the metadata for the existing annotation, with no attribute * values * * @param annotationType the annotation type (required) * @return a non-<code>null</code> instance * @since 1.2.0 */ public static AnnotationMetadata getInstance(final Class<?> annotationType) { return new AnnotationMetadataBuilder(annotationType).build(); }
/** * Builds and returns @SpringletsWebMvcTest annotation * * @return {@link AnnotationMetadataBuilder} */ private AnnotationMetadataBuilder getSpringletsWebMvcAnnotation() { AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(SpringletsJavaType.SPRINGLETS_WEB_MVC_TEST); annotationBuilder.addClassAttribute("controllers", this.controller); annotationBuilder.addBooleanAttribute("secure", false); return annotationBuilder; }
public static AnnotationMetadataBuilder getInstance(final JavaType annotationType, final Collection<AnnotationAttributeValue<?>> attributeValues) { return new AnnotationMetadataBuilder(annotationType, attributeValues); }
/** * Builds and returns `@RunWith` annotation * * @return {@link AnnotationMetadataBuilder} */ private AnnotationMetadataBuilder getRunWithAnnotation() { AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(RUN_WITH); annotationBuilder.addClassAttribute("value", SpringJavaType.SPRING_RUNNER); return annotationBuilder; }
/** * Builds and returns `@RunWith` annotation * * @return {@link AnnotationMetadataBuilder} */ private AnnotationMetadataBuilder getRunWithAnnotation() { AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(RUN_WITH); annotationBuilder.addClassAttribute("value", SpringJavaType.SPRING_RUNNER); return annotationBuilder; }