@Override public void updateEmbeddableToIdentifier(final JavaType identifierType, final String identifierField, final String identifierColumn) { Validate.notNull(identifierType, "Identifier type required"); // Get details from existing JavaType ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(getTypeLocationService().getTypeDetails( identifierType)); // Create @RooIdentifier with getters and setters AnnotationMetadataBuilder rooIdentifier = new AnnotationMetadataBuilder(ROO_IDENTIFIER); rooIdentifier.addBooleanAttribute("settersByDefault", true); final List<AnnotationMetadataBuilder> identifierAnnotations = Arrays.asList(new AnnotationMetadataBuilder(ROO_TO_STRING), new AnnotationMetadataBuilder( ROO_EQUALS), rooIdentifier); cidBuilder.setAnnotations(identifierAnnotations); // Set implement Serializable List<JavaType> implementTypes = new ArrayList<JavaType>(); implementTypes.add(JdkJavaType.SERIALIZABLE); cidBuilder.setImplementsTypes(implementTypes); getTypeManagementService().createOrUpdateTypeOnDisk(cidBuilder.build()); }
annotations.add(new AnnotationMetadataBuilder(ROO_EQUALS)); annotations.add(new AnnotationMetadataBuilder(ROO_SERIALIZABLE)); cidBuilder.setAnnotations(annotations);
new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, name, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations);
@Override public void newEmbeddableClass(final JavaType name, final boolean serializable) { Validate.notNull(name, "Embeddable name required"); final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, getPathResolver().getFocusedPath(Path.SRC_MAIN_JAVA)); final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(Arrays.asList(new AnnotationMetadataBuilder( ROO_JAVA_BEAN), new AnnotationMetadataBuilder(ROO_TO_STRING), new AnnotationMetadataBuilder(EMBEDDABLE))); if (serializable) { annotations.add(new AnnotationMetadataBuilder(ROO_SERIALIZABLE)); } final int modifier = Modifier.PUBLIC; final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, modifier, name, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations); getTypeManagementService().createOrUpdateTypeOnDisk(cidBuilder.build()); getProjectOperations().addDependency(name.getModule(), new Dependency("org.springframework.boot", "spring-boot-starter-data-jpa", null)); }
detailController, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations);
new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, mainController, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations);
new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataIdItem, Modifier.PUBLIC + Modifier.ABSTRACT, mixinClass, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations);
new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, collectionController, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations); new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataIdItem, Modifier.PUBLIC, itemController, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations);
cidBuilder.setAnnotations(annotations);
new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataIdItem, Modifier.PUBLIC, deserializerClass, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations);
cidBuilder.setAnnotations(getAnnotations()); cidBuilder.setCustomData(getCustomData()); cidBuilder.setDeclaredConstructors(getDeclaredConstructors());
cidBuilder.setAnnotations(annotations);
@Override public void updateEmbeddableToIdentifier(final JavaType identifierType, final String identifierField, final String identifierColumn) { Validate.notNull(identifierType, "Identifier type required"); // Get details from existing JavaType ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(getTypeLocationService().getTypeDetails( identifierType)); // Create @RooIdentifier with getters and setters AnnotationMetadataBuilder rooIdentifier = new AnnotationMetadataBuilder(ROO_IDENTIFIER); rooIdentifier.addBooleanAttribute("settersByDefault", true); final List<AnnotationMetadataBuilder> identifierAnnotations = Arrays.asList(new AnnotationMetadataBuilder(ROO_TO_STRING), new AnnotationMetadataBuilder( ROO_EQUALS), rooIdentifier); cidBuilder.setAnnotations(identifierAnnotations); // Set implement Serializable List<JavaType> implementTypes = new ArrayList<JavaType>(); implementTypes.add(JdkJavaType.SERIALIZABLE); cidBuilder.setImplementsTypes(implementTypes); getTypeManagementService().createOrUpdateTypeOnDisk(cidBuilder.build()); }
private void createIdentifierClass(final JavaType identifierType) { final List<AnnotationMetadataBuilder> identifierAnnotations = new ArrayList<AnnotationMetadataBuilder>(); final AnnotationMetadataBuilder identifierBuilder = new AnnotationMetadataBuilder( ROO_IDENTIFIER); identifierBuilder.addBooleanAttribute(DB_MANAGED.getSymbolName(), true); identifierAnnotations.add(identifierBuilder); // Produce identifier itself final String declaredByMetadataId = PhysicalTypeIdentifier .createIdentifier(identifierType, projectOperations .getPathResolver().getFocusedPath(Path.SRC_MAIN_JAVA)); final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder( declaredByMetadataId, Modifier.PUBLIC | Modifier.FINAL, identifierType, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(identifierAnnotations); typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build()); shell.flash(Level.FINE, "Created " + identifierType.getFullyQualifiedTypeName(), DbreDatabaseListenerImpl.class.getName()); shell.flash(Level.FINE, "", DbreDatabaseListenerImpl.class.getName()); }
cidBuilder.setAnnotations(annotations);
cidBuilder.setAnnotations(annotations);
annotations.add(new AnnotationMetadataBuilder(ROO_EQUALS)); annotations.add(new AnnotationMetadataBuilder(ROO_SERIALIZABLE)); cidBuilder.setAnnotations(annotations);
new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, name, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations);
@Override public void newEmbeddableClass(final JavaType name, final boolean serializable) { Validate.notNull(name, "Embeddable name required"); final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, getPathResolver().getFocusedPath(Path.SRC_MAIN_JAVA)); final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(Arrays.asList(new AnnotationMetadataBuilder( ROO_JAVA_BEAN), new AnnotationMetadataBuilder(ROO_TO_STRING), new AnnotationMetadataBuilder(EMBEDDABLE))); if (serializable) { annotations.add(new AnnotationMetadataBuilder(ROO_SERIALIZABLE)); } final int modifier = Modifier.PUBLIC; final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, modifier, name, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations); getTypeManagementService().createOrUpdateTypeOnDisk(cidBuilder.build()); getProjectOperations().addDependency(name.getModule(), new Dependency("org.springframework.boot", "spring-boot-starter-data-jpa", null)); }
cidBuilder.setAnnotations(getAnnotations()); cidBuilder.setCustomData(getCustomData()); cidBuilder.setDeclaredConstructors(getDeclaredConstructors());