jrworkspace by
jTEM

de.jtem.jrworkspace.plugin
Interface Controller

All Known Implementing Classes:
SimpleController

public interface Controller

The Controller interface of the jRWorkspace plug-in mechanism. It manages the communication between plug-ins through the getPlugin() methods. A plug-in that needs another plug-in to work with should call getPlugin() with the plug-ins class as argument.

Author:
Stefan Sechelmann

Method Summary
<T> T
deleteProperty(Class<?> context, String key)
          Deletes a property from this controller
<T extends Plugin>
T
getPlugin(Class<T> clazz)
          Returns an instance of the plug-in class clazz, if there is a plug-in of this class available.
<T> List<T>
getPlugins(Class<T> pClass)
          Returns all plug-ins for which the following expression evaluates to true pClass.isAssignableFrom(plug-in)
<T> T
getProperty(Class<?> context, String key, T defaultValue)
          Retrieves a property from this Controller.
 boolean isActive(Plugin p)
          Returns true if the controller believes this plug-in is active
 Object storeProperty(Class<?> context, String key, Object property)
          Stores the property with the given key and context class
 

Method Detail

deleteProperty

<T> T deleteProperty(Class<?> context,
                     String key)
Deletes a property from this controller

Type Parameters:
T - The property type
Parameters:
context - A context
key - The key name of the property to delete
Returns:
The deleted value or null if the key was not found

getPlugin

<T extends Plugin> T getPlugin(Class<T> clazz)
Returns an instance of the plug-in class clazz, if there is a plug-in of this class available. If the result is available but not yet installed it will be installed.

Type Parameters:
T - the class type of the plug-in to get
Parameters:
clazz - the class
Returns:
a plug-in or null if there is no plug-in of type class

getPlugins

<T> List<T> getPlugins(Class<T> pClass)
Returns all plug-ins for which the following expression evaluates to true pClass.isAssignableFrom(plug-in)

Type Parameters:
T - the plug-in class type
Parameters:
pClass - the class of type T
Returns:
A list of plug-ins

getProperty

<T> T getProperty(Class<?> context,
                  String key,
                  T defaultValue)
Retrieves a property from this Controller.

Type Parameters:
T - The property type
Parameters:
context - A context
key - the key name of the property to retrieve
defaultValue - a default value, which is returned if the property was not saved before
Returns:
the stored property or defaultValue

isActive

boolean isActive(Plugin p)
Returns true if the controller believes this plug-in is active

Parameters:
p - the plug-in
Returns:
active

storeProperty

Object storeProperty(Class<?> context,
                     String key,
                     Object property)
Stores the property with the given key and context class

Parameters:
context - the context class e.g. the plug-in class which stores the value
key - a key string
property - the property to save
Returns:
The old value of this property

jrworkspace by
jTEM

jTEM