public class TemplateArrayProperty extends AbstractProperty implements ListProperty
A ListProperty that is not attached to getter/setter methods on an underlying class, but instead stores its values internally. It can be used to manage array or list values of constructor/method arguments (rather than multi-valued object properties). Similar to TemplateProperty but multivalued.
Constructor and Description |
---|
TemplateArrayProperty(Configuration configuration,
java.lang.String name,
java.lang.Class<?> c) |
Modifier and Type | Method and Description |
---|---|
void |
addValue(java.lang.Object value) |
java.lang.Object |
getDefaultValue() |
int |
getNumValues() |
java.lang.Object |
getValue(int index) |
void |
insert(int index,
java.lang.Object value) |
boolean |
isFixedCardinality() |
void |
remove(int index) |
void |
setValue(int index,
java.lang.Object value) |
getConfiguration, getDefaultDocumentation, getDocumentation, getName, getType, isMutable, setDocumentation, setName
public TemplateArrayProperty(Configuration configuration, java.lang.String name, java.lang.Class<?> c)
configuration
- Configuration to which this Property belongsname
- Name of the propertyc
- Type of the property valuepublic void addValue(java.lang.Object value) throws StructuralException
addValue
in interface ListProperty
value
- New value to be added to the end of the listStructuralException
- if the value is invalid (as in setValue) or the Property is
immutable or fixed-cardinalityListProperty.addValue(java.lang.Object)
public int getNumValues()
getNumValues
in interface ListProperty
ListProperty.getNumValues()
public java.lang.Object getValue(int index) throws StructuralException
getValue
in interface ListProperty
index
- Index of a certain single value of a multi-valued propertyStructuralException
- if the given index is out of rangeListProperty.getValue(int)
public void insert(int index, java.lang.Object value) throws StructuralException
insert
in interface ListProperty
index
- Index at which new value is to be insertedvalue
- New valueStructuralException
- if the value is invalid (as in setValue) or the Property is
immutable or fixed-cardinality or the index is out of rangeListProperty.insert(int, java.lang.Object)
public boolean isFixedCardinality()
isFixedCardinality
in interface Property
Property.isFixedCardinality()
public void remove(int index) throws StructuralException
remove
in interface ListProperty
index
- Index of a single value of a multi-valued property that is to be removedStructuralException
- if the given index is out of range or the Property is immutable or fixed cardinalityListProperty.remove(int)
public void setValue(int index, java.lang.Object value) throws StructuralException
setValue
in interface ListProperty
index
- Index of a certain single value of a multi-valued propertyvalue
- New value to replace that at the given indexStructuralException
- if the value is invalid (as in setValue) or the given index is
out of range or the Property is immutableListProperty.setValue(int, java.lang.Object)
public java.lang.Object getDefaultValue()
getDefaultValue
in interface ListProperty
ListProperty.getDefaultValue()