@Beta public abstract class AbstractProjectableModel extends AbstractModel implements Projectable
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractProjectableModel.AnnotationDriverData
Projection of the parent entity as a driver data entity.
|
| Modifier and Type | Field and Description |
|---|---|
protected static String |
NO_DRIVER |
protected static String |
NO_DRIVER_SERVICE |
| Constructor and Description |
|---|
AbstractProjectableModel() |
AbstractProjectableModel(ProviderId providerId,
Annotations[] annotations)
Creates a model entity attributed to the specified provider and
optionally annotated.
|
| Modifier and Type | Method and Description |
|---|---|
<B extends Behaviour> |
as(Class<B> projectionClass)
Returns the specified projection of this entity if such projection
is supported.
|
protected DriverData |
asData()
Returns self as an immutable driver data instance.
|
protected void |
bindAndCheckDriver()
Attempts to bind the driver, if not already bound and checks that the
driver is bound.
|
protected void |
bindDriver()
Attempts to binds the driver, if not already bound.
|
Driver |
driver()
Returns the currently bound driver or null if no driver is bound.
|
protected static DriverService |
driverService()
Returns the currently bound driver service reference.
|
<B extends Behaviour> |
is(Class<B> projectionClass)
Returns true if this entity is capable of being projected as the
specified class.
|
protected Driver |
locateDriver()
Locates the driver to be used by this entity.
|
static void |
setDriverService(Object key,
DriverService driverService)
Injects the driver service reference for use during projections into
various behaviours.
|
providerIdannotationsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprojectprotected static final String NO_DRIVER_SERVICE
protected static final String NO_DRIVER
public AbstractProjectableModel()
public AbstractProjectableModel(ProviderId providerId, Annotations[] annotations)
providerId - identity of the providerannotations - optional key/value annotationspublic static void setDriverService(Object key, DriverService driverService)
This is a privileged call; unauthorized invocations will result in illegal state exception
key - opaque admin key objectdriverService - injected driver serviceIllegalStateException - when invoked sans authorizationprotected static DriverService driverService()
public Driver driver()
public <B extends Behaviour> B as(Class<B> projectionClass)
Projectableas in interface ProjectableB - type of behaviourprojectionClass - requested projection classpublic <B extends Behaviour> boolean is(Class<B> projectionClass)
Projectableis in interface ProjectableB - type of behaviourprojectionClass - requested projection classprotected Driver locateDriver()
The default implementation derives the driver based on the driver
annotation value.
protected final void bindDriver()
protected final void bindAndCheckDriver()
IllegalStateException - if driver cannot be boundprotected DriverData asData()