com.ryanm.config.imp
Class AnnotatedConfigurator

java.lang.Object
  extended by com.ryanm.config.imp.AbstractConfigurator
      extended by com.ryanm.config.imp.AnnotatedConfigurator
All Implemented Interfaces:
Configurator

public class AnnotatedConfigurator
extends AbstractConfigurator

A configurator that is constructed from an object annotated with the ConfigurableType annotation.

Author:
ryanm

Field Summary
 
Fields inherited from interface com.ryanm.config.Configurator
ACTION_TYPE, BOOLEAN_TYPE, COLOUR_TYPE, FILE_TYPE, FLOAT_TYPE, INT_TYPE, STRING_LIST_TYPE, STRING_TYPE, VECTOR_TYPE
 
Constructor Summary
protected AnnotatedConfigurator(java.lang.Object configurable)
          Builds a new AnnotatedConfigurator.
 
Method Summary
protected  void applyValue(java.lang.String name, java.lang.Object value)
          This should be overridden to actually apply the new value
static AnnotatedConfigurator buildConfigurator(java.lang.Object configurable)
          Builds a new Configurator for the supplied object
 java.lang.reflect.Field getField(java.lang.String name)
          Gets the Field that the specified variable name refers to
 java.lang.reflect.Method[] getMethods(java.lang.String name)
          Gets the Methods that control the specified variable refers to
 java.lang.Object retrieveValue(java.lang.String name)
          Get the current value of the named variable
 
Methods inherited from class com.ryanm.config.imp.AbstractConfigurator
addConfiguratorListener, addValueListener, addVariable, addVariable, buildPaths, copyValues, getDescription, getDescription, getName, getNames, getParent, getPath, getRange, getType, getValue, isGUIEnabled, pathsBuilt, removeConfiguratorListener, removeValueListener, removeVariable, setDescription, setGUIEnabled, setRange, setType, setValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotatedConfigurator

protected AnnotatedConfigurator(java.lang.Object configurable)
Builds a new AnnotatedConfigurator.

Parameters:
configurable - The configurable object. It is Assumed to be correctly annotated
Method Detail

buildConfigurator

public static AnnotatedConfigurator buildConfigurator(java.lang.Object configurable)
Builds a new Configurator for the supplied object

Parameters:
configurable - The object to configure
Returns:
A configurator, or null if the supplied object is not configurable

applyValue

protected void applyValue(java.lang.String name,
                          java.lang.Object value)
Description copied from class: AbstractConfigurator
This should be overridden to actually apply the new value

Specified by:
applyValue in class AbstractConfigurator
Parameters:
name - The name of the variable to change
value - The new value of that variable

retrieveValue

public java.lang.Object retrieveValue(java.lang.String name)
Description copied from class: AbstractConfigurator
Get the current value of the named variable

Specified by:
retrieveValue in class AbstractConfigurator
Parameters:
name - The name of the variable
Returns:
The value of the variable

getField

public java.lang.reflect.Field getField(java.lang.String name)
Gets the Field that the specified variable name refers to

Parameters:
name - The name of the configurable variable
Returns:
The field that is controlled by the variable, or null if there is no such field

getMethods

public java.lang.reflect.Method[] getMethods(java.lang.String name)
Gets the Methods that control the specified variable refers to

Parameters:
name - The name of the configurable variable
Returns:
A two element array of methods in {setMethod, getMethod} order, or null if no such variable