com.threerings.config
Class ParameterizedConfig

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.config.ManagedConfig
          extended by com.threerings.config.ParameterizedConfig
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, Exportable, ResourceManager.ModificationObserver, Copyable, Cloneable
Direct Known Subclasses:
ActorConfig, AnimationConfig, AreaConfig, BehaviorConfig, BoundConfig, EffectConfig, MaterialConfig, ModelConfig, PaintableConfig, ParameterizedHandlerConfig, PathConfig, PlaceableConfig, SceneGlobalConfig, ShaderConfig, SounderConfig, StyleConfig, TextureConfig, TileConfig, UserInterfaceConfig

public class ParameterizedConfig
extends ManagedConfig

A configuration that may include a number of parameters to be configured when the configuration is referenced.


Field Summary
protected  ArgumentMap _args
          The arguments applied to the configuration, if any.
protected  ParameterizedConfig _base
          The instance from which the configuration is derived, if any (used to prevent the base from being garbage-collected).
protected  SoftCache<ArgumentMap,ParameterizedConfig> _derived
          Maps arguments to derived instances.
 Parameter[] parameters
          The parameters of the configuration.
 
Fields inherited from class com.threerings.config.ManagedConfig
_cfgmgr, _listeners, _name, _updateConfigs, _updateResources
 
Constructor Summary
ParameterizedConfig()
           
 
Method Summary
protected  void applyArguments(ParameterizedConfig instance, ArgumentMap args)
          Applies the arguments in the provided map to the specified instance.
protected  void applyArguments(ParameterizedConfig instance, ArgumentMap args, Parameter[] params)
          Applies the arguments in the provided map to the specified instance.
protected  ParameterizedConfig getBound(Scope scope)
          Returns an instance of this config bound in the specified scope.
 ParameterizedConfig getInstance(Scope scope, ArgumentMap args)
          Returns the derived instance in the specified scope with the supplied arguments.
protected static Parameter getParameter(Parameter[] params, String name)
          Returns a reference to the parameter with the supplied name, or null if it doesn't exist.
 Parameter getParameter(String name)
          Returns a reference to the parameter with the supplied name, or null if it doesn't exist.
 ConfigReference<? extends ManagedConfig> getReference()
          Returns a reference to this configuration based on its name and arguments.
protected  void maybeFireOnConfigManager()
          Fires a configuration updated event on the config manager if appropriate.
 void validateOuters(String where)
          Validates the outer object references in this config.
 boolean validateReferences(String where, PrintStream out)
          Validates the references in this config.
 void wasUpdated()
          Notes that this configuration has been updated.
 
Methods inherited from class com.threerings.config.ManagedConfig
addListener, addUpdateDependencies, clearUpdateDependencies, configUpdated, fireConfigUpdated, getConfigManager, getInstance, getInstance, getInstance, getInstance, getName, getUpdateReferences, getUpdateResources, init, removeListener, resourceModified, setName, updateFromSource
 
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

parameters

@Editable(weight=1.0)
public Parameter[] parameters
The parameters of the configuration.


_base

@DeepOmit
protected transient ParameterizedConfig _base
The instance from which the configuration is derived, if any (used to prevent the base from being garbage-collected).


_args

@DeepOmit
protected transient ArgumentMap _args
The arguments applied to the configuration, if any.


_derived

@DeepOmit
protected transient SoftCache<ArgumentMap,ParameterizedConfig> _derived
Maps arguments to derived instances.

Constructor Detail

ParameterizedConfig

public ParameterizedConfig()
Method Detail

getParameter

public Parameter getParameter(String name)
Returns a reference to the parameter with the supplied name, or null if it doesn't exist.


getReference

public ConfigReference<? extends ManagedConfig> getReference()
Description copied from class: ManagedConfig
Returns a reference to this configuration based on its name and arguments.

Overrides:
getReference in class ManagedConfig

getInstance

public ParameterizedConfig getInstance(Scope scope,
                                       ArgumentMap args)
Description copied from class: ManagedConfig
Returns the derived instance in the specified scope with the supplied arguments.

Overrides:
getInstance in class ManagedConfig

wasUpdated

public void wasUpdated()
Description copied from class: ManagedConfig
Notes that this configuration has been updated.

Overrides:
wasUpdated in class ManagedConfig

validateReferences

public boolean validateReferences(String where,
                                  PrintStream out)
Description copied from class: ManagedConfig
Validates the references in this config.

Overrides:
validateReferences in class ManagedConfig
Returns:
true if the references are valid

validateOuters

public void validateOuters(String where)
Description copied from class: ManagedConfig
Validates the outer object references in this config.

Overrides:
validateOuters in class ManagedConfig

maybeFireOnConfigManager

protected void maybeFireOnConfigManager()
Description copied from class: ManagedConfig
Fires a configuration updated event on the config manager if appropriate.

Overrides:
maybeFireOnConfigManager in class ManagedConfig

getBound

protected ParameterizedConfig getBound(Scope scope)
Returns an instance of this config bound in the specified scope.


applyArguments

protected void applyArguments(ParameterizedConfig instance,
                              ArgumentMap args)
Applies the arguments in the provided map to the specified instance.


applyArguments

protected void applyArguments(ParameterizedConfig instance,
                              ArgumentMap args,
                              Parameter[] params)
Applies the arguments in the provided map to the specified instance.


getParameter

protected static Parameter getParameter(Parameter[] params,
                                        String name)
Returns a reference to the parameter with the supplied name, or null if it doesn't exist.