com.threerings.config
Class Parameter

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.config.Parameter
All Implemented Interfaces:
Exportable, Copyable, Cloneable
Direct Known Subclasses:
Parameter.Choice, Parameter.Direct

@EditorTypes(value={Parameter.Direct.class,Parameter.Choice.class,Parameter.Translated.class})
public abstract class Parameter
extends DeepObject
implements Exportable

A single configuration parameter.


Nested Class Summary
static class Parameter.Choice
          A parameter that allows choosing between several options.
static class Parameter.Direct
          A parameter that directly controls a number of fields identified by paths.
static class Parameter.Translated
          A parameter that translates its values.
 
Field Summary
protected  Property _argumentProperty
          The argument property corresponding to this parameter.
protected  Property _property
          The property corresponding to this parameter.
protected static Property INVALID_PROPERTY
          Indicates that a property field is invalid and should be (re)created.
 String name
          The name of the parameter.
 
Constructor Summary
Parameter()
           
 
Method Summary
protected abstract  Property createArgumentProperty(ParameterizedConfig reference)
          Creates the property used to set and retrieve the argument corresponding to this property.
protected abstract  Property createProperty(ParameterizedConfig reference)
          Creates the property used to apply this parameter.
 Property getArgumentProperty(ParameterizedConfig reference)
          Retrieves the property used to set and retrieve the argument corresponding to this property.
 Property getProperty(ParameterizedConfig reference)
          Retrieves the property used to apply this parameter.
 void invalidateProperties()
          Invalidates the properties, forcing them to be recreated.
 void validateOuters(String where, ParameterizedConfig outer)
          Validates the parameter's outer object references.
abstract  boolean validatePaths(String where, ParameterizedConfig reference, PrintStream out)
          Validates the parameter's paths.
 
Methods inherited from class com.threerings.util.DeepObject
clone, copy, copy, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

@Editable
public String name
The name of the parameter.


_property

@DeepOmit
protected transient Property _property
The property corresponding to this parameter.


_argumentProperty

@DeepOmit
protected transient Property _argumentProperty
The argument property corresponding to this parameter.


INVALID_PROPERTY

protected static final Property INVALID_PROPERTY
Indicates that a property field is invalid and should be (re)created.

Constructor Detail

Parameter

public Parameter()
Method Detail

getProperty

public Property getProperty(ParameterizedConfig reference)
Retrieves the property used to apply this parameter.

Parameters:
reference - the configuration to use as a reference to resolve paths.
Returns:
the property, or null if the parameter is invalid.

getArgumentProperty

public Property getArgumentProperty(ParameterizedConfig reference)
Retrieves the property used to set and retrieve the argument corresponding to this property. The property's Property.get(java.lang.Object) and Property.set(java.lang.Object, java.lang.Object) methods will expect a Map instance with keys representing the parameter names and values representing the argument values. Retrieving the property value will return the value in the map (or, if absent, the default value obtained from the reference object) and setting the value will set the value in the map (unless it is equal to the default, in which case it will be removed).

Parameters:
reference - the configuration to use as a reference to resolve paths and obtain default values.
Returns:
the property, or null if the parameter is invalid.

invalidateProperties

public void invalidateProperties()
Invalidates the properties, forcing them to be recreated.


validatePaths

public abstract boolean validatePaths(String where,
                                      ParameterizedConfig reference,
                                      PrintStream out)
Validates the parameter's paths.

Returns:
true if the paths are valid.

validateOuters

public void validateOuters(String where,
                           ParameterizedConfig outer)
Validates the parameter's outer object references.


createProperty

protected abstract Property createProperty(ParameterizedConfig reference)
Creates the property used to apply this parameter.


createArgumentProperty

protected abstract Property createArgumentProperty(ParameterizedConfig reference)
Creates the property used to set and retrieve the argument corresponding to this property.