ca.nengo.config.impl
Class SingleValuedPropertyImpl
java.lang.Object
ca.nengo.config.impl.AbstractProperty
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 belongsname
- Parameter namec
- Parameter typegetter
- 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 belongsname
- Parameter namec
- Parameter typegetter
- Zero-arg getter methodsetter
- Single-arg setter method
getSingleValuedProperty
public static SingleValuedProperty getSingleValuedProperty(Configuration configuration,
java.lang.String name,
java.lang.Class<?> type)
- Parameters:
configuration
- Configuration to which this Property belongsname
- Parameter nametype
- 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()