parent
4acd1afa3b
commit
901c85f6c0
2 changed files with 10 additions and 0 deletions
|
@ -156,6 +156,7 @@ public class GenerateEntityImplementationsProcessor extends AbstractGenerateEnti
|
|||
TypeMirror fieldType = determineFieldType(fieldName, methods);
|
||||
pw.println(" public static final String FIELD_NAME = \"" + fieldName + "\";");
|
||||
pw.println(" public static final String FIELD_NAME_DASHED = \"" + fieldName.replaceAll("([^_A-Z])([A-Z])", "$1-$2").toLowerCase() + "\";");
|
||||
pw.println(" public static final String FIELD_NAME_CAMEL_CASE = \"" + fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1) + "\";");
|
||||
pw.println(" @SuppressWarnings(\"unchecked\") @Override public Class<?> getFieldClass() {");
|
||||
pw.println(" return " + types.erasure(fieldType) + ".class;");
|
||||
pw.println(" }");
|
||||
|
@ -165,6 +166,9 @@ public class GenerateEntityImplementationsProcessor extends AbstractGenerateEnti
|
|||
pw.println(" @Override public String getNameDashed() {");
|
||||
pw.println(" return FIELD_NAME_DASHED;");
|
||||
pw.println(" }");
|
||||
pw.println(" @Override public String getNameCamelCase() {");
|
||||
pw.println(" return FIELD_NAME_CAMEL_CASE;");
|
||||
pw.println(" }");
|
||||
|
||||
FieldAccessorType.getMethod(FieldAccessorType.COLLECTION_ADD, methods, fieldName, types, fieldType).ifPresent(method -> {
|
||||
TypeMirror firstParameterType = method.getParameters().get(0).asType();
|
||||
|
|
|
@ -16,6 +16,12 @@ public interface EntityField<E> {
|
|||
* @return
|
||||
*/
|
||||
String getName();
|
||||
/*
|
||||
* Returns name of this field in camel case with first word starting with lower case letter and
|
||||
* further words starting with a capital letter.
|
||||
* @return
|
||||
*/
|
||||
String getNameCamelCase();
|
||||
/**
|
||||
* Returns name of this field in lowercase with words separated by a dash ({@code -}).
|
||||
* @return
|
||||
|
|
Loading…
Reference in a new issue