public class DefaultCustomEntityFactory extends java.lang.Object implements CustomEntityFactory
| Constructor and Description |
|---|
DefaultCustomEntityFactory() |
| Modifier and Type | Method and Description |
|---|---|
<T extends Entity> |
newInstance(TxBindings txBindings,
java.lang.Class<T> entityInterface)
Construct a custom entity class that implements
entityInterface replacing the default class. |
public <T extends Entity> T newInstance(TxBindings txBindings, java.lang.Class<T> entityInterface)
CustomEntityFactoryentityInterface replacing the default class.
The interface is self-implementing; default methods delegate to bindings. As a consequence, a custom entity class
can focus on custom behavior and not be concerned about maintaining existing behavior.
A typical custom entity class.
import org.example.schema.sampledb.Actor;
import manifold.sql.rt.api.TxBindings;
public class CustomActor implements Actor extends BaseEntity {
private CustomActor(TxBindings bindings) {
super(bindings);
}
// your code here...
}
A custom class may override any of the entityInterface methods and provide any number of its own methods.newInstance in interface CustomEntityFactoryT - The entity interface to implement.txBindings - The TxBindings instance the returned class instance receives in its constructor. This instance
must be maintained by this class and returned from the getBindings() method.entityInterface - The interface the class of the returned entity instance must implement.entityInterface or null the entity is not customized.Copyright © 2023. All rights reserved.