11package dev .sassine .api .structure .export .builder ;
22
3+ import static dev .sassine .api .structure .type .TypeConverter .TYPE_INTEGER ;
4+ import static dev .sassine .api .structure .type .TypeConverter .TYPE_STRING ;
5+ import static dev .sassine .api .structure .type .TypeConverter .TYPE_UUID ;
36import static java .lang .String .format ;
47import static java .lang .System .getProperty ;
58import static java .util .Optional .ofNullable ;
2932
3033import dev .sassine .api .structure .model .java .EntityModel ;
3134import dev .sassine .api .structure .model .java .FieldModel ;
32- import dev .sassine .api .structure .type .TypeConverter ;
3335import lombok .Getter ;
3436import lombok .NoArgsConstructor ;
3537import lombok .Setter ;
@@ -60,11 +62,11 @@ public class BuilderEntity {
6062 private static final String PARAM_VALUE = "value" ;
6163 private static final String PARAM_NAME = "name" ;
6264
63- public void build (List <EntityModel > entityModel ,boolean isAutoGenerated ) {
65+ public static void build (List <EntityModel > entityModel ,boolean isAutoGenerated ) {
6466 entityModel .forEach (e -> build (e ,isAutoGenerated ));
6567 }
6668
67- private void build (EntityModel entityModel ,boolean isAutoGenerated ) {
69+ private static void build (EntityModel entityModel ,boolean isAutoGenerated ) {
6870 String nameClass = toCamelCase (entityModel .getName (), true , '_' );
6971 String packageName = "dev.sassine.api.structure.delete" ;
7072
@@ -74,7 +76,7 @@ private void build(EntityModel entityModel,boolean isAutoGenerated) {
7476
7577 }
7678
77- private void createRepository (EntityModel entityModel , String nameClass , String packageName ) {
79+ private static void createRepository (EntityModel entityModel , String nameClass , String packageName ) {
7880
7981 UnitSourceGenerator gen = UnitSourceGenerator
8082 .create (format (FORMAT_PACKAGE_DOT_PACKAGE , packageName , PACKAGE_REPOSITORY_NAME ));
@@ -93,19 +95,19 @@ private void createRepository(EntityModel entityModel, String nameClass, String
9395 store (gen );
9496 }
9597
96- private Class <?> getIdClassType (EntityModel entityModel ) {
98+ private static Class <?> getIdClassType (EntityModel entityModel ) {
9799 String pkType = entityModel .getPkType ();
98- if (TypeConverter . TYPE_STRING .equalsIgnoreCase (pkType ))
100+ if (TYPE_STRING .equalsIgnoreCase (pkType ))
99101 return String .class ;
100- else if (TypeConverter . TYPE_UUID .equalsIgnoreCase (pkType ))
102+ else if (TYPE_UUID .equalsIgnoreCase (pkType ))
101103 return UUID .class ;
102- else if (TypeConverter . TYPE_INTEGER .equalsIgnoreCase (pkType ))
104+ else if (TYPE_INTEGER .equalsIgnoreCase (pkType ))
103105 return Integer .class ;
104106 else
105107 return Long .class ;
106108 }
107109
108- private void createDTO (EntityModel entityModel , String nameClass , String packageName ) {
110+ private static void createDTO (EntityModel entityModel , String nameClass , String packageName ) {
109111
110112 UnitSourceGenerator gen = UnitSourceGenerator
111113 .create (format (FORMAT_PACKAGE_DOT_PACKAGE , packageName , PACKAGE_DTO_NAME ));
@@ -142,7 +144,7 @@ private void createDTO(EntityModel entityModel, String nameClass, String package
142144 store (gen );
143145 }
144146
145- private void createEntity (EntityModel entityModel , boolean isAutoGenerated , String nameClass ,
147+ private static void createEntity (EntityModel entityModel , boolean isAutoGenerated , String nameClass ,
146148 String packageName ) {
147149
148150 UnitSourceGenerator gen = UnitSourceGenerator
@@ -179,24 +181,24 @@ private void createEntity(EntityModel entityModel, boolean isAutoGenerated, Stri
179181 store (gen );
180182 }
181183
182- private void generateEntityPK (boolean isAutoGenerated , FieldModel fieldModel , VariableSourceGenerator field , EntityModel entityModel ) {
184+ private static void generateEntityPK (boolean isAutoGenerated , FieldModel fieldModel , VariableSourceGenerator field , EntityModel entityModel ) {
183185 if (ofNullable (fieldModel .getIsPrimaryKey ()).orElse (false )) {
184186 field .addAnnotation (AnnotationSourceGenerator .create (Id .class ));
185187 if (isAutoGenerated ) field .addAnnotation (AnnotationSourceGenerator .create (GeneratedValue .class ));
186188 entityModel .setPkType (fieldModel .getType ());
187189 }
188190 }
189191
190- private void importLocalDateTime (UnitSourceGenerator gen , FieldModel fieldModel ) {
192+ private static void importLocalDateTime (UnitSourceGenerator gen , FieldModel fieldModel ) {
191193 if (LOCAL_DATE_TIME .equals (fieldModel .getType ()))
192194 gen .addImport (LocalDateTime .class );
193195 }
194196
195- private void store (UnitSourceGenerator gen ) {
197+ private static void store (UnitSourceGenerator gen ) {
196198 gen .storeToClassPath (getProperty ("user.dir" ) + "/src/main/java/" );
197199 }
198200
199- private void importEntityClass (String nameClass , String packageName , UnitSourceGenerator gen ) {
201+ private static void importEntityClass (String nameClass , String packageName , UnitSourceGenerator gen ) {
200202 gen .addImport (format (FORMAT_IMPORT_ENTITY_PACKAGE , packageName , nameClass ));
201203 }
202204
0 commit comments