Purpose: Used to allow complex inheritance support. Typically class indicators are used to define inheritance in the database, however in complex cases the class type may be determined through another mechanism. The method calls a static method on the descriptor class to determine the class to use for the database row.
org.eclipse.persistence.descriptors.InheritancePolicy#setClassExtractor
| Modifier and Type | Field and Description |
|---|---|
| protected transient Method | |
| protected String | |
| protected transient ClassDescriptor |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public <T> Class | extractClassFromRow(DataRecord row, Session session)
Implements abstract org. |
| public Method | |
| public String | getClassExtractionMethodName()
PUBLIC: A class extraction method can be registered with the descriptor to override the default inheritance mechanism. |
| protected ClassDescriptor | |
| public void | initialize(ClassDescriptor descriptor, Session session)
Overrides org. |
| protected void | |
| public void | setClassExtractionMethodName(String staticClassClassExtractionMethod)
PUBLIC: A class extraction method can be registered with the descriptor to override the default inheritance mechanism. |
| protected void |
| classExtractionMethod | back to summary |
|---|---|
| protected transient Method classExtractionMethod | |
| classExtractionMethodName | back to summary |
|---|---|
| protected String classExtractionMethodName | |
| descriptor | back to summary |
|---|---|
| protected transient ClassDescriptor descriptor | |
| MethodClassExtractor | back to summary |
|---|---|
| public MethodClassExtractor() | |
| extractClassFromRow | back to summary |
|---|---|
| public <T> Class Implements abstract org. INTERNAL Extract/compute the class from the database row and return the class. Map is used as the public interface to database row, the key is the field name, the value is the database value.
| |
| getClassExtractionMethod | back to summary |
|---|---|
| public Method getClassExtractionMethod() INTERNAL: Return all the classExtractionMethod | |
| getClassExtractionMethodName | back to summary |
|---|---|
| public String getClassExtractionMethodName() PUBLIC: A class extraction method can be registered with the descriptor to override the default inheritance mechanism. This allows for the class indicator field to not be used, and a user defined one instead. The method registered must be a static method on the class that the descriptor is for, the method must take DatabaseRow as argument, and must return the class to use for that row. This method will be used to decide which class to instantiate when reading from the database. It is the application's responsibility to populate any typing information in the database required to determine the class from the row. If this method is used then the class indicator field and mapping cannot be used, also the descriptor's withAllSubclasses and onlyInstances expressions must also be setup correctly. | |
| getDescriptor | back to summary |
|---|---|
| protected ClassDescriptor getDescriptor() INTERNAL: Return the descriptor. | |
| initialize | back to summary |
|---|---|
| public void initialize(ClassDescriptor descriptor, Session session) throws DescriptorException Overrides org. INTERNAL: Setup the default classExtractionMethod, or if one was specified by the user make sure it is valid.
| |
| setClassExtractionMethod | back to summary |
|---|---|
| protected void setClassExtractionMethod(Method classExtractionMethod) INTERNAL: | |
| setClassExtractionMethodName | back to summary |
|---|---|
| public void setClassExtractionMethodName(String staticClassClassExtractionMethod) PUBLIC: A class extraction method can be registered with the descriptor to override the default inheritance mechanism. This allows for the class indicator field to not be used, and a user defined one instead. The method registered must be a static method on the class that the descriptor is for, the method must take DatabaseRow as argument, and must return the class to use for that row. This method will be used to decide which class to instantiate when reading from the database. It is the application's responsibility to populate any typing information in the database required to determine the class from the row. If this method is used then the class indicator field and mapping cannot be used, also the descriptor's withAllSubclasses and onlyInstances expressions must also be setup correctly. | |
| setDescriptor | back to summary |
|---|---|
| protected void setDescriptor(ClassDescriptor descriptor) INTERNAL: Set the descriptor. | |