Package com.bc.ceres.binding
Interface PropertySet
-
- All Superinterfaces:
PropertyChangeEmitter
- All Known Subinterfaces:
FigureStyle
- All Known Implementing Classes:
DefaultFigureStyle
,PropertyContainer
public interface PropertySet extends PropertyChangeEmitter
A loose aggregation of properties. Properties can be added to and removed from this set. Property change events are fired whenever property values change.The
PropertySet
interface is based on the well-known Property List design pattern.- Since:
- 0.10
- See Also:
Property
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addProperties(Property... properties)
Adds the given properties to this set.void
addProperty(Property property)
Adds a property to this set.PropertyDescriptor
getDescriptor(String name)
Gets the descriptor for the named property.Property[]
getProperties()
Gets all properties currently contained in this set.Property
getProperty(String name)
Gets the named property.<T> T
getValue(String name)
Gets the value of the named property.boolean
isPropertyDefined(String name)
Tests if the named property is defined in this set.void
removeProperties(Property... properties)
Removes the given properties from this set.void
removeProperty(Property property)
Removes a property from this set.void
setDefaultValues()
Sets all properties to their default values.void
setValue(String name, Object value)
Sets the value of the named property.-
Methods inherited from interface com.bc.ceres.binding.PropertyChangeEmitter
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Method Detail
-
getProperties
Property[] getProperties()
Gets all properties currently contained in this set.- Returns:
- The array of properties, which may be empty.
-
isPropertyDefined
boolean isPropertyDefined(String name)
Tests if the named property is defined in this set. For undefined properties, the methodgetProperty(name)
will always returnnull
.- Parameters:
name
- The property name or the property's alias name (both case sensitive).- Returns:
true
if the property is defined.
-
getProperty
Property getProperty(String name)
Gets the named property.- Parameters:
name
- The property name or the property's alias name (both case sensitive).- Returns:
- The property, or
null
if the property does not exist. - See Also:
isPropertyDefined(String)
,PropertyDescriptor.getAlias()
-
addProperty
void addProperty(Property property)
Adds a property to this set.- Parameters:
property
- The property.
-
addProperties
void addProperties(Property... properties)
Adds the given properties to this set.- Parameters:
properties
- The properties to be added.
-
removeProperty
void removeProperty(Property property)
Removes a property from this set.- Parameters:
property
- The property.
-
removeProperties
void removeProperties(Property... properties)
Removes the given properties from this set.- Parameters:
properties
- The properties to be removed.
-
getValue
<T> T getValue(String name) throws ClassCastException
Gets the value of the named property.- Parameters:
name
- The property name.- Returns:
- The property value or
null
if a property with the given name does not exist. - Throws:
ClassCastException
- if the value is not of the requested type.
-
setValue
void setValue(String name, Object value) throws IllegalArgumentException
Sets the value of the named property.- Parameters:
name
- The property name.value
- The new property value.- Throws:
IllegalArgumentException
- If the value is illegal. The cause will always be aValidationException
.
-
setDefaultValues
void setDefaultValues() throws IllegalStateException
Sets all properties to their default values.- Throws:
IllegalStateException
- If at least one of the default values is illegal. The cause will always be aValidationException
.- Since:
- Ceres 0.12
- See Also:
PropertyDescriptor.getDefaultValue()
-
getDescriptor
PropertyDescriptor getDescriptor(String name)
Gets the descriptor for the named property.- Parameters:
name
- The property name (case sensitive).- Returns:
- The descriptor, or
null
if the property is unknown.
-
-