org.specrunner.plugins.core.objects
Class PluginObjectManager

java.lang.Object
  extended by org.specrunner.plugins.core.objects.PluginObjectManager

public class PluginObjectManager
extends Object

Manages the set of AbstractPluginObject created on a given specification.

Author:
Thiago Santos

Field Summary
protected  Map<Class<?>,AbstractPluginObject> entities
          Map of instances for a given entity.
 
Constructor Summary
PluginObjectManager()
           
 
Method Summary
 void bind(AbstractPluginObject input)
          Bind a object plugin to the manager.
 void clear()
          Clear all object mappings.
static PluginObjectManager get()
          The object manager instance (Thread safe).
 Map<Class<?>,AbstractPluginObject> getEntities()
          The mapping of all entities.
 boolean isBound(Class<?> clazz)
          Check if a given class is bound to a AbstractPluginObject.
 Object lookup(Class<?> clazz, String key)
          Lookup for a object of a given type, with the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entities

protected Map<Class<?>,AbstractPluginObject> entities
Map of instances for a given entity.

Constructor Detail

PluginObjectManager

public PluginObjectManager()
Method Detail

get

public static PluginObjectManager get()
The object manager instance (Thread safe).

Returns:
The instance.

clear

public void clear()
Clear all object mappings.


isBound

public boolean isBound(Class<?> clazz)
Check if a given class is bound to a AbstractPluginObject.

Parameters:
clazz - The object type.
Returns:
true, of bound, false, otherwise.

bind

public void bind(AbstractPluginObject input)
Bind a object plugin to the manager.

Parameters:
input - The object plugin.

lookup

public Object lookup(Class<?> clazz,
                     String key)
              throws PluginException
Lookup for a object of a given type, with the given key.

Parameters:
clazz - The object type.
key - The object key.
Returns:
The object if exists,null, otherwise.
Throws:
PluginException - On lookup errors.

getEntities

public Map<Class<?>,AbstractPluginObject> getEntities()
The mapping of all entities.

Returns:
The entity mapping.


Copyright © 2014. All rights reserved.