ca.nengo.config.impl
Class TemplateProperty

java.lang.Object
  extended by ca.nengo.config.impl.AbstractProperty
      extended by ca.nengo.config.impl.TemplateProperty
All Implemented Interfaces:
Property, SingleValuedProperty

public class TemplateProperty
extends AbstractProperty
implements SingleValuedProperty

A SingleValuedProperty that is not attached to getter/setter methods on an underlying class, but instead stores its value internally. It can be used to manage values of constructor/method arguments (rather than object properties).

Author:
Bryan Tripp

Constructor Summary
TemplateProperty(Configuration configuration, java.lang.String name, java.lang.Class<?> c, java.lang.Object defaultValue)
           
 
Method Summary
 java.lang.Object getValue()
           
 boolean isFixedCardinality()
           
 void setValue(java.lang.Object value)
           
 
Methods inherited from class ca.nengo.config.impl.AbstractProperty
getConfiguration, getDefaultDocumentation, getDocumentation, getName, getType, isMutable, setDocumentation, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.nengo.config.Property
getDocumentation, getName, getType, isMutable, setName
 

Constructor Detail

TemplateProperty

public TemplateProperty(Configuration configuration,
                        java.lang.String name,
                        java.lang.Class<?> c,
                        java.lang.Object defaultValue)
Parameters:
configuration - Configuration to which this Property belongs
name - Name of the property
c - Type of the property value
defaultValue - Default property value
Method Detail

getValue

public java.lang.Object getValue()
Specified by:
getValue in interface SingleValuedProperty
Returns:
Value (for single-valued properties) or first value (for multi-valued properties)
See Also:
SingleValuedProperty.getValue()

isFixedCardinality

public boolean isFixedCardinality()
Specified by:
isFixedCardinality in interface Property
Returns:
True if the property has a fixed number of values
See Also:
Property.isFixedCardinality()

setValue

public void setValue(java.lang.Object value)
              throws StructuralException
Specified by:
setValue in interface SingleValuedProperty
Parameters:
value - New value (for single-valued properties) or first value (for multi-valued properties)
Throws:
StructuralException - if the given value is not one of the allowed classes, or if the Configurable rejects it for any other reason (eg inconsistency with other properties)
See Also:
SingleValuedProperty.setValue(java.lang.Object)