Nengo.ca

ca.nengo.config.impl
Class SingleValuedPropertyImpl

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

public class SingleValuedPropertyImpl
extends AbstractProperty
implements SingleValuedProperty

Default implementation of single-valued Properties.


Constructor Summary
SingleValuedPropertyImpl(Configuration configuration, java.lang.String name, java.lang.Class<?> c, java.lang.reflect.Method getter)
          Constructor for immutable single-valued properties.
SingleValuedPropertyImpl(Configuration configuration, java.lang.String name, java.lang.Class<?> c, java.lang.reflect.Method getter, java.lang.reflect.Method setter)
          Constructor for mutable single-valued properties.
 
Method Summary
 java.lang.String getDocumentation()
           
static SingleValuedProperty getSingleValuedProperty(Configuration configuration, java.lang.String name, java.lang.Class<?> type)
           
 java.lang.Object getValue()
           
 boolean isFixedCardinality()
           
 void setValue(java.lang.Object value)
          By default, attempts to call method setX(y) on Configurable, where X is the name of the property (with first letter capitalized) and y is the value (changed to a primitive if it's a primitive wrapper).
 
Methods inherited from class ca.nengo.config.impl.AbstractProperty
getConfiguration, getDefaultDocumentation, 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
getName, getType, isMutable, setName
 

Constructor Detail

SingleValuedPropertyImpl

public SingleValuedPropertyImpl(Configuration configuration,
                                java.lang.String name,
                                java.lang.Class<?> c,
                                java.lang.reflect.Method getter)
Constructor for immutable single-valued properties.

Parameters:
configuration - Configuration to which this Property belongs
name - Parameter name
c - Parameter type
getter - Zero-arg getter method

SingleValuedPropertyImpl

public SingleValuedPropertyImpl(Configuration configuration,
                                java.lang.String name,
                                java.lang.Class<?> c,
                                java.lang.reflect.Method getter,
                                java.lang.reflect.Method setter)
Constructor for mutable single-valued properties.

Parameters:
configuration - Configuration to which this Property belongs
name - Parameter name
c - Parameter type
getter - Zero-arg getter method
setter - Single-arg setter method
Method Detail

getSingleValuedProperty

public static SingleValuedProperty getSingleValuedProperty(Configuration configuration,
                                                           java.lang.String name,
                                                           java.lang.Class<?> type)
Parameters:
configuration - Configuration to which this Property belongs
name - Parameter name
type - Parameter type
Returns:
Property or null if the necessary methods don't exist on the underlying class

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
By default, attempts to call method setX(y) on Configurable, where X is the name of the property (with first letter capitalized) and y is the value (changed to a primitive if it's a primitive wrapper). A Configurable that needs different behaviour should override this method.

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)

getDocumentation

public java.lang.String getDocumentation()
Specified by:
getDocumentation in interface Property
Overrides:
getDocumentation in class AbstractProperty
Returns:
Text describing the property semantics (plain text or HTML)
See Also:
Property.getDocumentation()

Nengo.ca