Class AbstractProjectableModel

    • Constructor Detail

      • AbstractProjectableModel

        public AbstractProjectableModel()
      • AbstractProjectableModel

        public AbstractProjectableModel​(ProviderId providerId,
                                        Annotations[] annotations)
        Creates a model entity attributed to the specified provider and optionally annotated.
        Parameters:
        providerId - identity of the provider
        annotations - optional key/value annotations
    • Method Detail

      • setDriverService

        public static void setDriverService​(Object key,
                                            DriverService driverService)
        Injects the driver service reference for use during projections into various behaviours.

        This is a privileged call; unauthorized invocations will result in illegal state exception

        Parameters:
        key - opaque admin key object
        driverService - injected driver service
        Throws:
        IllegalStateException - when invoked sans authorization
      • driverService

        protected static DriverService driverService()
        Returns the currently bound driver service reference.
        Returns:
        driver service
      • driver

        public Driver driver()
        Returns the currently bound driver or null if no driver is bound.
        Returns:
        bound driver; null if none
      • as

        public <B extends Behaviour> B as​(Class<B> projectionClass)
        Description copied from interface: Projectable
        Returns the specified projection of this entity if such projection is supported.
        Specified by:
        as in interface Projectable
        Type Parameters:
        B - type of behaviour
        Parameters:
        projectionClass - requested projection class
        Returns:
        projection instance
      • is

        public <B extends Behaviour> boolean is​(Class<B> projectionClass)
        Description copied from interface: Projectable
        Returns true if this entity is capable of being projected as the specified class.
        Specified by:
        is in interface Projectable
        Type Parameters:
        B - type of behaviour
        Parameters:
        projectionClass - requested projection class
        Returns:
        true if the requested projection is supported
      • locateDriver

        protected Driver locateDriver()
        Locates the driver to be used by this entity.

        The default implementation derives the driver based on the driver annotation value.

        Returns:
        driver for alternate projections of this model entity or null if no driver is expected or driver is not found
      • bindDriver

        protected final void bindDriver()
        Attempts to binds the driver, if not already bound.
      • bindAndCheckDriver

        protected final void bindAndCheckDriver()
        Attempts to bind the driver, if not already bound and checks that the driver is bound.
        Throws:
        IllegalStateException - if driver cannot be bound
      • asData

        protected DriverData asData()
        Returns self as an immutable driver data instance.
        Returns:
        self as driver data