Package io.guise.framework.platform
Class AbstractPlatform
- java.lang.Object
-
- io.guise.framework.platform.AbstractPlatform
-
- All Implemented Interfaces:
Platform
- Direct Known Subclasses:
AbstractWebPlatform
public abstract class AbstractPlatform extends java.lang.Object implements Platform
The platform on which Guise objects are being depicted.- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description AbstractPlatform(GuiseApplication application)
Application constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
generateDepictID()
Generates a new depict ID unique to this session platform.GuiseApplication
getApplication()
DepictedObject
getDepictedObject(long depictedObjectID)
Retrieves a depicted object that has been registered with the platform by the ID of the depicted object.java.util.concurrent.locks.Lock
getDepictLock()
<O extends DepictedObject>
Depictor<? super O>getDepictor(O depictedObject)
Determines the depictor appropriate for the given depicted object.protected <O extends DepictedObject>
java.lang.Class<? extends Depictor<? super O>>getDepictorClass(java.lang.Class<O> depictedObjectClass)
Determines the depictor class appropriate for the given depicted object class.protected <O extends DepictedObject>
java.lang.Class<? extends Depictor<? super O>>getRegisteredDepictorClass(java.lang.Class<? extends DepictedObject> depictedObjectClass)
Determines the depictor class registered for the given depicted object class.java.util.Queue<? extends PlatformMessage>
getSendMessageQueue()
void
registerDepictedObject(DepictedObject depictedObject)
Registers a depicted object so that it can interact with the platform.protected <O extends DepictedObject>
java.lang.Class<? extends Depictor<? super O>>registerDepictorClass(java.lang.Class<O> depictedObjectClass, java.lang.Class<?> depictorClass)
Registers the class of a depictor to depict an object of the given class (and by default subclasses).void
unregisterDepictedObject(DepictedObject depictedObject)
Unregisters a depicted object so that no longer interacts with the platform.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.guise.framework.platform.Platform
getClientProduct, getDepictContext, getEnvironment, selectPlatformFiles, sendResource, sendResource, sendResource, sendResource
-
-
-
-
Constructor Detail
-
AbstractPlatform
public AbstractPlatform(GuiseApplication application)
Application constructor.- Parameters:
application
- The Guise application running on this platform.- Throws:
java.lang.NullPointerException
- if the given application and/or environment isnull
.
-
-
Method Detail
-
getApplication
public GuiseApplication getApplication()
- Specified by:
getApplication
in interfacePlatform
- Returns:
- The Guise application running on this platform.
-
getDepictLock
public java.util.concurrent.locks.Lock getDepictLock()
- Specified by:
getDepictLock
in interfacePlatform
- Returns:
- The lock used for exclusive depiction on the platform.
-
registerDepictorClass
protected <O extends DepictedObject> java.lang.Class<? extends Depictor<? super O>> registerDepictorClass(java.lang.Class<O> depictedObjectClass, java.lang.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> java.lang.Class<? extends Depictor<? super O>> getRegisteredDepictorClass(java.lang.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> java.lang.Class<? extends Depictor<? super O>> getDepictorClass(java.lang.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 interfacePlatform
- 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 interfacePlatform
- 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 interfacePlatform
- 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 interfacePlatform
- 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 interfacePlatform
- Returns:
- A new depict ID unique to this session platform.
-
getSendMessageQueue
public java.util.Queue<? extends PlatformMessage> getSendMessageQueue()
- Specified by:
getSendMessageQueue
in interfacePlatform
- Returns:
- The thread-safe queue of messages to be delivered to the platform.
-
-