Compare commits

..

3 Commits

Author SHA1 Message Date
3e7c100982
[maven-release-plugin] prepare for next development iteration
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-24 13:19:10 +03:00
3e720c380d
[maven-release-plugin] prepare release v.0.0.9 2023-01-24 13:19:10 +03:00
8e79e74c0b
Добавил поле CLASS_NAME в SimpleMode 2023-01-24 13:18:56 +03:00
4 changed files with 18 additions and 19 deletions

View File

@ -9,7 +9,7 @@
<groupId>dev.struchkov.haiti.utils</groupId>
<artifactId>haiti-utils-field-constants</artifactId>
<version>0.0.9-SNAPSHOT</version>
<version>0.0.10-SNAPSHOT</version>
<name>Haiti Field Name Constants Utils</name>
<description>Generating class field names</description>

View File

@ -1,8 +1,7 @@
package dev.struchkov.haiti.utils.fieldconstants.creator;
import dev.struchkov.haiti.utils.fieldconstants.domain.mode.simple.SimpleFieldDto;
import dev.struchkov.haiti.utils.fieldconstants.domain.mode.table.SimpleTableFieldDto;
import dev.struchkov.haiti.utils.fieldconstants.domain.mode.simple.ClassSimpleDto;
import dev.struchkov.haiti.utils.fieldconstants.domain.mode.simple.SimpleFieldDto;
import javax.annotation.processing.ProcessingEnvironment;
import javax.tools.JavaFileObject;
@ -27,7 +26,7 @@ public final class CreatorClassSimpleMode {
public static void record(ClassSimpleDto classDto, ProcessingEnvironment environment) {
JavaFileObject builderFile = null;
try {
builderFile = environment.getFiler().createSourceFile(classDto.getClassName());
builderFile = environment.getFiler().createSourceFile(classDto.getNewClassName());
} catch (IOException e) {
e.printStackTrace();
}
@ -36,8 +35,9 @@ public final class CreatorClassSimpleMode {
out.println("package " + classDto.getClassPackage() + ";");
out.println();
out.println();
out.print(format("public class {0} '{'", classDto.getClassName()));
out.println(format("public class {0} '{'", classDto.getNewClassName()));
out.println();
out.println(format(" public static final String CLASS_NAME = \"{0}\";", classDto.getOldClassName()));
out.println();
generateSimpleNames(classDto.getSimpleFields(), out);
out.println("}");

View File

@ -5,8 +5,8 @@ import java.util.List;
public class ClassSimpleDto {
private String classPackage;
private String className;
private String tableName;
private String newClassName;
private String oldClassName;
private List<SimpleFieldDto> simpleFields;
public String getClassPackage() {
@ -17,20 +17,20 @@ public class ClassSimpleDto {
this.classPackage = classPackage;
}
public String getClassName() {
return className;
public String getNewClassName() {
return newClassName;
}
public void setClassName(String className) {
this.className = className;
public void setNewClassName(String newClassName) {
this.newClassName = newClassName;
}
public String getTableName() {
return tableName;
public String getOldClassName() {
return oldClassName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
public void setOldClassName(String oldClassName) {
this.oldClassName = oldClassName;
}
public List<SimpleFieldDto> getSimpleFields() {

View File

@ -14,9 +14,7 @@ import java.util.List;
public class GeneratorSimpleMode {
public static void generate(ProcessingEnvironment processingEnv, Element annotatedElement) {
final String annotatedElementName = annotatedElement.getSimpleName().toString();
final String newClassName = annotatedElementName + Mode.SIMPLE.getDefaultPostfix();
final String oldClassName = annotatedElement.getSimpleName().toString();
final List<? extends Element> allFields = annotatedElement.getEnclosedElements().stream()
.filter(Generator::isField)
@ -26,7 +24,8 @@ public class GeneratorSimpleMode {
final List<SimpleFieldDto> simpleFields = getSimpleFields(allFields);
final ClassSimpleDto newClass = new ClassSimpleDto();
newClass.setClassName(newClassName);
newClass.setNewClassName(oldClassName + Mode.SIMPLE.getDefaultPostfix());
newClass.setOldClassName(oldClassName);
newClass.setSimpleFields(simpleFields);
newClass.setClassPackage(Generator.getPackage(annotatedElement));