|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.nengo.config.impl.AbstractProperty
ca.nengo.config.impl.NamedValuePropertyImpl
public class NamedValuePropertyImpl
Default implementation of NamedValueProperty. This implementation uses reflection to call methods on an underlying configurable object in order to get and set multiple property values.
Use of this class is analogous to ListPropertyImpl
. See
ListPropertyImpl docs for more information.
Constructor Summary | |
---|---|
NamedValuePropertyImpl(Configuration configuration,
java.lang.String name,
java.lang.Class<?> c,
java.lang.reflect.Method mapGetter)
|
|
NamedValuePropertyImpl(Configuration configuration,
java.lang.String name,
java.lang.Class<?> c,
java.lang.reflect.Method getter,
java.lang.reflect.Method namesGetter)
|
Method Summary | |
---|---|
java.lang.String |
getDocumentation()
|
static NamedValueProperty |
getNamedValueProperty(Configuration configuration,
java.lang.String name,
java.lang.Class<?> type)
|
java.lang.Object |
getValue(java.lang.String name)
|
java.util.List<java.lang.String> |
getValueNames()
|
boolean |
isFixedCardinality()
|
boolean |
isMutable()
|
boolean |
isNamedAutomatically()
|
void |
removeValue(java.lang.String name)
Removes a value by name |
void |
setModifiers(java.lang.reflect.Method setter,
java.lang.reflect.Method remover)
Sets optional methods used to make the property mutable. |
void |
setValue(java.lang.Object value)
Sets an automatically-named value |
void |
setValue(java.lang.String name,
java.lang.Object value)
Sets a value by name. |
Methods inherited from class ca.nengo.config.impl.AbstractProperty |
---|
getConfiguration, getDefaultDocumentation, getName, getType, 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, setName |
Constructor Detail |
---|
public NamedValuePropertyImpl(Configuration configuration, java.lang.String name, java.lang.Class<?> c, java.lang.reflect.Method getter, java.lang.reflect.Method namesGetter)
configuration
- Configuration to which this Property belongsname
- Parameter namec
- Parameter typegetter
- A method on type c with a String argument that returns the named property valuenamesGetter
- A zero-argument method on type c that returns a String array with names of the property valuespublic NamedValuePropertyImpl(Configuration configuration, java.lang.String name, java.lang.Class<?> c, java.lang.reflect.Method mapGetter)
configuration
- Configuration to which this Property belongsname
- Parameter namec
- Parameter typemapGetter
- A zero-argument method on type c that returns a MapMethod Detail |
---|
public static NamedValueProperty getNamedValueProperty(Configuration configuration, java.lang.String name, java.lang.Class<?> type)
configuration
- Configuration to which this Property belongsname
- Parameter nametype
- Parameter type
public void setModifiers(java.lang.reflect.Method setter, java.lang.reflect.Method remover)
setter
- A setter method with arg types {String, Object}; {Object} is also OK if the getType() has
a zero-arg method getName() which returns a Stringremover
- A method that removes a value by name; arg types {String}public java.lang.Object getValue(java.lang.String name) throws StructuralException
getValue
in interface NamedValueProperty
name
- Name of a value of this property
StructuralException
NamedValueProperty.getValue(java.lang.String)
public java.util.List<java.lang.String> getValueNames()
getValueNames
in interface NamedValueProperty
NamedValueProperty.getValueNames()
public boolean isNamedAutomatically()
isNamedAutomatically
in interface NamedValueProperty
NamedValueProperty.isNamedAutomatically()
public void removeValue(java.lang.String name) throws StructuralException
NamedValueProperty
removeValue
in interface NamedValueProperty
name
- Name of value to remove
StructuralException
- if isFixedCardinality()NamedValueProperty.removeValue(java.lang.String)
public void setValue(java.lang.String name, java.lang.Object value) throws StructuralException
NamedValueProperty
setValue
in interface NamedValueProperty
name
- Name of the valuevalue
- New value of the value
StructuralException
- if !isMutablepublic void setValue(java.lang.Object value) throws StructuralException
NamedValueProperty
setValue
in interface NamedValueProperty
value
- New value of the value, from which the Property can automaticall
determine the name
StructuralException
- if !isNamedAutomatically() or !isMutablepublic boolean isFixedCardinality()
isFixedCardinality
in interface Property
Property.isFixedCardinality()
public boolean isMutable()
isMutable
in interface Property
isMutable
in class AbstractProperty
AbstractProperty.isMutable()
public java.lang.String getDocumentation()
getDocumentation
in interface Property
getDocumentation
in class AbstractProperty
Property.getDocumentation()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |