Class AbstractPlatform

java.lang.Object
io.guise.framework.platform.AbstractPlatform
All Implemented Interfaces:
Platform
Direct Known Subclasses:
AbstractWebPlatform

public abstract class AbstractPlatform extends Object implements Platform
The platform on which Guise objects are being depicted.
Author:
Garret Wilson
  • Constructor Details

    • AbstractPlatform

      public AbstractPlatform(GuiseApplication application)
      Application constructor.
      Parameters:
      application - The Guise application running on this platform.
      Throws:
      NullPointerException - if the given application and/or environment is null.
  • Method Details

    • getApplication

      public GuiseApplication getApplication()
      Specified by:
      getApplication in interface Platform
      Returns:
      The Guise application running on this platform.
    • getDepictLock

      public Lock getDepictLock()
      Specified by:
      getDepictLock in interface Platform
      Returns:
      The lock used for exclusive depiction on the platform.
    • registerDepictorClass

      protected <O extends DepictedObject> Class<? extends Depictor<? super O>> registerDepictorClass(Class<O> depictedObjectClass, Class<?> depictorClass)
      Registers the class of a depictor to depict an object of the given class (and by default subclasses).
      Type Parameters:
      O - The type of registered depicted object class.
      Parameters:
      depictedObjectClass - The class of the depicted object for which the depictor should be registered.
      depictorClass - The class of depictor to use for depicting the objects.
      Returns:
      The depictor class previously registered with the given depicted object class, or null if there was no previous registration.
    • getRegisteredDepictorClass

      protected <O extends DepictedObject> Class<? extends Depictor<? super O>> getRegisteredDepictorClass(Class<? extends DepictedObject> depictedObjectClass)
      Determines the depictor class registered for the given depicted object class.
      Type Parameters:
      O - The type of registered depicted object class.
      Parameters:
      depictedObjectClass - The class of depicted object that may be registered.
      Returns:
      The class of depictor registered to depict object of the specific class, or null if no depictor is registered.
    • getDepictorClass

      protected <O extends DepictedObject> Class<? extends Depictor<? super O>> getDepictorClass(Class<O> depictedObjectClass)
      Determines the depictor class appropriate for the given depicted object class. A depicted class is located by individually looking up the depicted object class hierarchy for registered depictors.
      Type Parameters:
      O - The type of registered depicted object class.
      Parameters:
      depictedObjectClass - The class of depicted object for which a depictor should be returned.
      Returns:
      A class of depictor for the given depicted object class, or null if no depictor is registered.
    • getDepictor

      public <O extends DepictedObject> Depictor<? super O> getDepictor(O depictedObject)
      Description copied from interface: Platform
      Determines the depictor appropriate for the given depicted object. A depictor class is located by individually looking up the depicted object class hiearchy for registered depictor classes.
      Specified by:
      getDepictor in interface Platform
      Type Parameters:
      O - The type of depicted object.
      Parameters:
      depictedObject - The depicted object for which a depictor should be returned.
      Returns:
      A depictor to depict the given component, or null if no depictor is registered.
    • registerDepictedObject

      public void registerDepictedObject(DepictedObject depictedObject)
      Description copied from interface: Platform
      Registers a depicted object so that it can interact with the platform.
      Specified by:
      registerDepictedObject in interface Platform
      Parameters:
      depictedObject - The depicted object to register.
    • unregisterDepictedObject

      public void unregisterDepictedObject(DepictedObject depictedObject)
      Description copied from interface: Platform
      Unregisters a depicted object so that no longer interacts with the platform.
      Specified by:
      unregisterDepictedObject in interface Platform
      Parameters:
      depictedObject - The depicted object to unregister.
    • getDepictedObject

      public DepictedObject getDepictedObject(long depictedObjectID)
      Description copied from interface: Platform
      Retrieves a depicted object that has been registered with the platform by the ID of the depicted object.
      Specified by:
      getDepictedObject in interface Platform
      Parameters:
      depictedObjectID - The ID of the depicted object to retrieve.
      Returns:
      The registered depicted object with the given ID, or null if there is no depicted object registered with this platform with the given ID.
    • generateDepictID

      public long generateDepictID()
      Description copied from interface: Platform
      Generates a new depict ID unique to this session platform.
      Specified by:
      generateDepictID in interface Platform
      Returns:
      A new depict ID unique to this session platform.
    • getSendMessageQueue

      public Queue<? extends PlatformMessage> getSendMessageQueue()
      Specified by:
      getSendMessageQueue in interface Platform
      Returns:
      The thread-safe queue of messages to be delivered to the platform.