/** * 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; }
/** * 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; }
/** * 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 @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 @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; }
private FieldMetadataBuilder getDeseralizerFieldFor(FieldMetadata field, JavaType deserializer) { AnnotationMetadataBuilder annotation = new AnnotationMetadataBuilder(JSON_DESERIALIZE); annotation.addClassAttribute("using", deserializer); return new FieldMetadataBuilder(getId(), Modifier.PRIVATE, Arrays.asList(annotation), field.getFieldName(), field.getFieldType()); }
new AnnotationMetadataBuilder(SpringJavaType.ENABLE_JPA_REPOSITORIES); enableRepositoriesAnnotationBuilder.addClassAttribute("repositoryBaseClass", SpringletsJavaType.SPRINGLETS_DETACHABLE_JPA_REPOSITORY_IMPL); .addClassAttribute("basePackageClasses", applicationMainType); AnnotationMetadataBuilder entityScanAnnotationBuilder = new AnnotationMetadataBuilder(SpringJavaType.ENTITY_SCAN); entityScanAnnotationBuilder.addClassAttribute("basePackageClasses", applicationMainType); ensureGovernorIsAnnotated(entityScanAnnotationBuilder);
this.propertyIdGenerator = entityMetadata.getCurrentIndentifierField().getFieldName(); AnnotationMetadataBuilder identifyInfo = new AnnotationMetadataBuilder(JSON_IDENTITY_INFO); identifyInfo.addClassAttribute("generator", OBJECT_ID_GENERATORS_PROPERTY_GENERATOR); identifyInfo.addStringAttribute("property", this.propertyIdGenerator.getSymbolName()); ensureGovernorIsAnnotated(identifyInfo);
AnnotationMetadataBuilder exceptionHandler = new AnnotationMetadataBuilder(SpringJavaType.EXCEPTION_HANDLER); exceptionHandler.addClassAttribute("value", exception); annotationTypes.add(responsebody); annotationTypes.add(exceptionHandler);
AnnotationMetadataBuilder exceptionHandler = new AnnotationMetadataBuilder(SpringJavaType.EXCEPTION_HANDLER); exceptionHandler.addClassAttribute("value", exception); annotationTypes.add(exceptionHandler);
rooIntegrationTestAnnotation.addClassAttribute("targetClass", type); rooIntegrationTestAnnotation.addClassAttribute("dodConfigurationClass", creator.getDataOnDemandConfiguration()); rooIntegrationTestAnnotation.addClassAttribute("dodClass", creator.getDataOnDemand(managedEntity));
entityFactoryAnnotation.addClassAttribute("entity", entity); cidBuilder.addAnnotation(entityFactoryAnnotation);
@Override public void createUnitTest(final JavaType entity) { Validate.notNull(entity, "Class to produce an unit test class for is required"); // Check if provided JavaType is a Repository ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(entity); Validate.notNull(cid.getAnnotation(RooJavaType.ROO_JPA_ENTITY), "Type must be a Roo JPA Entity type."); // Create JPA DataOnDemand artifacts List<DataOnDemandCreatorProvider> dodCreators = getValidDataOnDemandCreatorsForType(entity); for (DataOnDemandCreatorProvider dodCreator : dodCreators) { dodCreator.createDataOnDemand(entity); } final JavaType name = new JavaType(entity + "Test", entity.getModule()); final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, Path.SRC_TEST_JAVA.getModulePathId(entity.getModule())); if (metadataService.get(declaredByMetadataId) != null) { // The file already exists return; } // Add @RooUnitTest to source file AnnotationMetadataBuilder rooUnitTestAnnotation = new AnnotationMetadataBuilder(RooJavaType.ROO_JPA_UNIT_TEST); rooUnitTestAnnotation.addClassAttribute("targetClass", entity); final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, name, PhysicalTypeCategory.CLASS); cidBuilder.addAnnotation(rooUnitTestAnnotation); typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build()); }
projectionAnnotation.addClassAttribute("entity", entity); List<StringAttributeValue> fieldNames = new ArrayList<StringAttributeValue>();
rooIntegrationTestAnnotation.addClassAttribute("targetClass", type);
rooIntegrationTestAnnotation.addClassAttribute("targetClass", type);
mixinAnnotation.addClassAttribute(ENTITY_KEY, entity); annotations.add(mixinAnnotation);
controllerAnnotation.addClassAttribute("entity", entity); if (StringUtils.isNotBlank(pathPrefix)) { controllerAnnotation.addStringAttribute("pathPrefix", pathPrefix);
AnnotationMetadataBuilder deserializerAnnotation = new AnnotationMetadataBuilder(RooJavaType.ROO_DESERIALIZER); deserializerAnnotation.addClassAttribute(ENTITY_KEY, entity); annotations.add(deserializerAnnotation);