T - the value class (e.g. String)public class ValuedProperty<T> extends ICalProperty
| Modifier and Type | Field and Description |
|---|---|
protected T |
value |
parameters| Constructor and Description |
|---|
ValuedProperty(T value)
Creates a new valued property.
|
ValuedProperty(ValuedProperty<T> original)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
T |
getValue()
Gets the value of this property.
|
static <T> T |
getValue(ValuedProperty<T> property)
Utility method that gets the value of a
ValuedProperty object. |
int |
hashCode() |
void |
setValue(T value)
Sets the value of this property.
|
protected Map<String,Object> |
toStringValues()
Gets string representations of the class's fields for the
ICalProperty.toString() method. |
protected void |
validate(List<ICalComponent> components,
ICalVersion version,
List<Warning> warnings)
Checks the property for data consistency problems or deviations from the
specifications.
|
protected boolean |
valueEquals(T otherValue)
Compares this property's value with another property's value for
equality.
|
protected int |
valueHashCode()
Calculates the hash code of this property's value.
|
addParameter, copy, getParameter, getParameters, getParameters, removeParameter, setParameter, setParameter, setParameters, toString, validatepublic ValuedProperty(T value)
value - the property's valuepublic ValuedProperty(ValuedProperty<T> original)
original - the property to make a copy ofpublic void setValue(T value)
value - the valueprotected void validate(List<ICalComponent> components, ICalVersion version, List<Warning> warnings)
ICalPropertyChecks the property for data consistency problems or deviations from the specifications.
This method should be overridden by child classes that wish to provide validation logic. The default implementation of this method does nothing.
validate in class ICalPropertycomponents - the hierarchy of components that the property belongs
toversion - the version to validate againstwarnings - the list to add the warnings topublic static <T> T getValue(ValuedProperty<T> property)
ValuedProperty object.T - the value classproperty - the property object (may be null)protected Map<String,Object> toStringValues()
ICalProperty
Gets string representations of the class's fields for the
ICalProperty.toString() method.
Meant to be overridden by child classes. The default implementation returns an empty map.
toStringValues in class ICalPropertypublic int hashCode()
hashCode in class ICalPropertypublic boolean equals(Object obj)
equals in class ICalPropertyprotected int valueHashCode()
Calculates the hash code of this property's value.
This method is meant by to overridden by child classes whose value's hash
code cannot be calculated by just invoking hashCode(). For
example, a property whose value is case insensitive. The default
implementation of this method calls value.hashCode().
This method is only invoked when this property's value is not null.
protected boolean valueEquals(T otherValue)
Compares this property's value with another property's value for equality.
This method is meant by to overridden by child classes when their value's
equality cannot be calculated by just invoking equals(). For
example, a property whose value is case insensitive. The default
implementation of this method calls value.equals(otherValue).
This method is only invoked when this property's value is not null.
otherValue - the other property's valueCopyright © 2013-2016 Michael Angstadt. All Rights Reserved.