Ejemplo n.º 1
0
 public List<JavaFile> generate() {
   MigrationVersionMetadata migrationVersion = schemaName().migrationVersion();
   return type()
       .stream()
       .map(type -> migrationVersion.generate(type))
       .collect(MoreCollectors.toImmutableList());
 }
Ejemplo n.º 2
0
 private TypeSpec migrationType() {
   MigrationVersionMetadata migrationVersion = schemaName().migrationVersion();
   ClassName className = migrationVersion.className();
   return TypeSpec.classBuilder(className.simpleName())
       .addAnnotation(migrationAnnotation())
       .addTypes(
           tableInfoList()
               .stream()
               .map(TableInfoMetadata::type)
               .collect(MoreCollectors.toImmutableList()))
       .build();
 }
Ejemplo n.º 3
0
 private TypeSpec schemaType() {
   MigrationVersionMetadata migrationVersion = schemaName().migrationVersion();
   return TypeSpec.classBuilder(schemaName().simpleName())
       .addAnnotation(schemaAnnotation(migrationVersion))
       .addModifiers(Modifier.PUBLIC)
       .addMethod(MethodSpec.constructorBuilder().addModifiers(Modifier.PRIVATE).build())
       .addMethods(
           tableInfoList()
               .stream()
               .map(TableInfoMetadata::schemaMethod)
               .collect(MoreCollectors.toImmutableList()))
       .build();
 }