Package org.adempiere.util
Class ModelInterfaceGenerator
java.lang.Object
org.adempiere.util.ModelInterfaceGenerator
Generate interface class for model
- Author:
- Trifon Trifonov, Teo Sarca, SC ARHIPAC SERVICE SRL
- BF [ 1781629 ] Don't use Env.NL in model class/interface generators
- FR [ 1781630 ] Generated class/interfaces have a lot of unused imports
- BF [ 1781632 ] Generated class/interfaces should be UTF-8
- better formating of generated source
- BF [ 1787833 ] ModelInterfaceGenerator: don't write timestamp
- FR [ 1803309 ] Model generator: generate get method for Search cols
- BF [ 1817768 ] Isolate hardcoded table direct columns https://sourceforge.net/p/adempiere/bugs/827/
- FR [ 2343096 ] Model Generator: Improve Reference Class Detection
- BF [ 2528434 ] ModelInterfaceGenerator: generate getters for common fields
- --
- FR [ 2848449 ] ModelClassGenerator: Implement model getters https://sourceforge.net/p/adempiere/feature-requests/812/, Teo Sarca, teo.sarca@gmail.com
- FR [ 3020635 ] Model Generator should use FQ class names https://sourceforge.net/p/adempiere/feature-requests/987/, Victor Perez, e-Evolution
- FR [ 1785001 ] Using ModelPackage of EntityType to Generate Model Class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionModelInterfaceGenerator
(int AD_Table_ID, String directory, String packageName, String entityTypeFilter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
generateJavaComment
(String startOfComment, String propertyName, String description, StringBuilder result) Generate javadoc comment for methods.static void
generateSource
(String sourceFolder, String packageName, String entityType, String tableName, String columnEntityType) static void
generateSource
(String type, String sourceFolder, String packageName, String entityType, String tableName, String columnEntityType) static Class<?>
Get class for given display type and referencestatic String
getDataTypeName
(Class<?> cl, int displayType) static String
getFieldName
(String columnName) static String
getModelPackage
(String entityType) Get EntityType Model Package.static String
getReferenceClassName
(int AD_Table_ID, String columnName, int displayType, int AD_Reference_ID) static boolean
isGenerateModelGetter
(String columnName) static boolean
isGenerateModelGetterForEntity
(int AD_Table_ID, String toEntityType) static boolean
isGenerateSetter
(String columnName) toString()
String representation
-
Field Details
-
NL
- See Also:
-
COPY
File Header- See Also:
-
GEN_SOURCE_INTERFACE
- See Also:
-
GEN_SOURCE_CLASS
- See Also:
-
-
Constructor Details
-
Method Details
-
generateJavaComment
public void generateJavaComment(String startOfComment, String propertyName, String description, StringBuilder result) Generate javadoc comment for methods.- Parameters:
startOfComment
-propertyName
-description
-result
-
-
getClass
Get class for given display type and reference- Parameters:
displayType
-AD_Reference_ID
-- Returns:
- class
-
getDataTypeName
- Parameters:
cl
-displayType
-- Returns:
- Java data type name (without the package part)
-
isGenerateSetter
- Parameters:
columnName
-- Returns:
- true if a setter method should be generated
-
isGenerateModelGetter
- Parameters:
columnName
-- Returns:
- true if a model getter method (method that is returning referenced PO) should be generated
-
isGenerateModelGetterForEntity
- Parameters:
AD_Table_ID
-toEntityType
-- Returns:
- true if a model getter method (method that is returning referenced PO) should be generated
-
getModelPackage
Get EntityType Model Package. author Victor Perez - [ 1785001 ] Using ModelPackage of EntityType to Generate Model Class- Parameters:
entityType
-- Returns:
- Java package name or null
-
getFieldName
- Parameters:
columnName
-- Returns:
- Java field name
-
getReferenceClassName
public static String getReferenceClassName(int AD_Table_ID, String columnName, int displayType, int AD_Reference_ID) - Parameters:
AD_Table_ID
-columnName
-displayType
-AD_Reference_ID
-- Returns:
- Java class name or null
-
toString
String representation -
generateSource
public static void generateSource(String sourceFolder, String packageName, String entityType, String tableName, String columnEntityType) - Parameters:
sourceFolder
-packageName
-entityType
-tableName
- table LikecolumnEntityType
-
-
generateSource
public static void generateSource(String type, String sourceFolder, String packageName, String entityType, String tableName, String columnEntityType) - Parameters:
sourceFolder
-packageName
-entityType
-tableName
- table LikecolumnEntityType
-
-