Nengo.ca

ca.nengo.config
Class ClassRegistry

java.lang.Object
  extended by ca.nengo.config.ClassRegistry

public final class ClassRegistry
extends java.lang.Object

A registry of implementations of selected types of interest (subclasses and interface implementations). This gets used when generating the list of available input functions (e.g., PFunction in simulator-ui) TODO: unit tests


Field Summary
static java.lang.String IMPLS_LOCATION_PROPERTY
          Location of implementations...
static java.lang.String TYPES_LOCATION_PROPERTY
          Location of types...
 
Method Summary
 void addRegisterableType(java.lang.Class<?> type)
          Adds a class to the list of types whose implementations can be registered (only implementations of certain types can be registered).
 java.util.List<java.lang.Class<?>> getImplementations(java.lang.Class<?> type)
           
static ClassRegistry getInstance()
           
 void register(java.lang.Class<?> implementation)
          Registers an implementation against any of the registerable types which it is assignable from.
 void register(java.lang.String implementationName)
          As register(Class), but by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPES_LOCATION_PROPERTY

public static final java.lang.String TYPES_LOCATION_PROPERTY
Location of types...

See Also:
Constant Field Values

IMPLS_LOCATION_PROPERTY

public static final java.lang.String IMPLS_LOCATION_PROPERTY
Location of implementations...

See Also:
Constant Field Values
Method Detail

getInstance

public static ClassRegistry getInstance()
Returns:
Shared instance

addRegisterableType

public void addRegisterableType(java.lang.Class<?> type)
Adds a class to the list of types whose implementations can be registered (only implementations of certain types can be registered).

Parameters:
type - Type to add to list of registerable types

register

public void register(java.lang.Class<?> implementation)
Registers an implementation against any of the registerable types which it is assignable from.

Parameters:
implementation - Class to register as an implementation of matching registerable types

register

public void register(java.lang.String implementationName)
              throws java.lang.ClassNotFoundException
As register(Class), but by name.

Parameters:
implementationName - Name of implementation to register
Throws:
java.lang.ClassNotFoundException - if the class doesn't exist?

getImplementations

public java.util.List<java.lang.Class<?>> getImplementations(java.lang.Class<?> type)
Parameters:
type - A registerable type
Returns:
A list of registered implementations of the given type (empty if type is unknown)

Nengo.ca