Package org.adempiere.base
Class AnnotationBasedModelFactory
- java.lang.Object
-
- org.adempiere.base.AnnotationBasedFactory
-
- org.adempiere.base.AnnotationBasedModelFactory
-
- All Implemented Interfaces:
IModelFactory
- Direct Known Subclasses:
WS_ModelFactory
public class AnnotationBasedModelFactory extends AnnotationBasedFactory implements IModelFactory
Translates table names into model classes having theModel
annotation. Relies onDefaultModelFactory
for everything else. This factory is designed to have a service rank higher thanDefaultModelFactory
, as class discovery using SPI is preferred over reflection-based methods.- Author:
- Saulo Gil, Heng Sin
-
-
Constructor Summary
Constructors Constructor Description AnnotationBasedModelFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(org.osgi.service.component.ComponentContext context)
protected String[]
getAcceptClassesPatterns()
Extension point.Class<?>
getClass(String tableName)
Get Persistence Class for Tableprotected String[]
getPackages()
Extension point.PO
getPO(String tableName, int Record_ID, String trxName)
Get PO Class InstancePO
getPO(String tableName, ResultSet rs, String trxName)
Get PO Class Instance-
Methods inherited from class org.adempiere.base.AnnotationBasedFactory
blockWhileScanning, getExecutorService, getMaxThreads, getScanFailureHandler, signalScanCompletion
-
-
-
-
Method Detail
-
getPackages
protected String[] getPackages()
Extension point. Subclasses might override this method in order to have faster model class scanning.- Returns:
- array of packages to be accepted during class scanning
- See Also:
ClassGraph.acceptPackagesNonRecursive(String...)
-
getAcceptClassesPatterns
protected String[] getAcceptClassesPatterns()
Extension point. Provide a list of patterns to match against class names.- Returns:
- array of strings containing patterns
- See Also:
ClassGraph.acceptClasses(String...)
-
activate
public void activate(org.osgi.service.component.ComponentContext context) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
getClass
public Class<?> getClass(String tableName)
Get Persistence Class for Table- Specified by:
getClass
in interfaceIModelFactory
- Parameters:
tableName
- table name- Returns:
- class or null
-
getPO
public PO getPO(String tableName, int Record_ID, String trxName)
Get PO Class Instance- Specified by:
getPO
in interfaceIModelFactory
Record_ID
- record- Returns:
- PO for Record or null
-
-