public class ExtendedPropertySet extends java.lang.Object implements PropertySet
Modifier | Constructor and Description |
---|---|
protected |
ExtendedPropertySet()
Protected, because only sub classes can set the data.
|
protected |
ExtendedPropertySet(PropertySet local,
PropertySet parent) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Property<?> prop) |
static PropertySet |
extend(PropertySet parent,
PropertySet extension)
Creates a new property set that is the extension on top of the parent.
|
<T> T |
get(Property<T> prop)
Retrieves the value of the property, or null if this set doesn't contain that property.
|
int |
getCount() |
PropertySet |
getLocal() |
<T> T |
getOrDefault(Property<T> prop) |
<T> T |
getOrElse(Property<T> property,
T value)
Get the value for a given
Property , or else fall back to value if it's not present. |
PropertySet |
getParent() |
<T> T |
getParentProperty(Property<T> prop) |
java.util.Collection<Property<?>> |
getProperties() |
java.util.List<PropertyValue> |
getValues() |
boolean |
isExtended(Property<?> prop)
Returns whether this property set contains a value for the prop, and the prop was actually inherited.
|
boolean |
isInherited(Property<?> prop)
Indicates whether the property was inherited from a parent type.
|
java.util.Iterator<PropertyValue> |
iterator() |
void |
merge(PropertySet other)
Merges the values from other collection into this one.
|
void |
remove(Property<?> prop) |
<T> void |
set(Property<T> prop,
T value) |
void |
set(PropertyValue propValue) |
protected void |
setLocal(PropertySet value) |
protected void |
setParent(PropertySet value) |
java.lang.String |
toString() |
protected ExtendedPropertySet(PropertySet local, PropertySet parent)
protected ExtendedPropertySet()
public PropertySet getLocal()
public PropertySet getParent()
protected void setLocal(PropertySet value)
protected void setParent(PropertySet value)
public <T> T get(Property<T> prop)
PropertyValueSource
get
in interface PropertyValueSource
public <T> T getOrDefault(Property<T> prop)
getOrDefault
in interface PropertyValueSource
Property.getDefaultValue()
if not present.public <T> T getOrElse(Property<T> property, T value)
PropertyValueSource
Property
, or else fall back to value if it's not present.getOrElse
in interface PropertyValueSource
property
- The Property
for which a value is to be retrieved.value
- The value to default to if property isn't present.public <T> T getParentProperty(Property<T> prop)
public <T> void set(Property<T> prop, T value)
set
in interface MutablePropertyValueSource
public void set(PropertyValue propValue)
set
in interface MutablePropertyValueSource
public void remove(Property<?> prop)
remove
in interface MutablePropertyValueSource
public boolean contains(Property<?> prop)
contains
in interface PropertyValueSource
public java.util.Collection<Property<?>> getProperties()
getProperties
in interface PropertySet
public java.util.List<PropertyValue> getValues()
getValues
in interface PropertySet
public java.util.Iterator<PropertyValue> iterator()
iterator
in interface java.lang.Iterable<PropertyValue>
public static PropertySet extend(PropertySet parent, PropertySet extension)
public boolean isExtended(Property<?> prop)
PropertyValueSource
isExtended
in interface PropertyValueSource
public boolean isInherited(Property<?> prop)
PropertyValueSource
isInherited
in interface PropertyValueSource
public java.lang.String toString()
toString
in class java.lang.Object
public void merge(PropertySet other)
Mergable
merge
in interface Mergable<PropertySet>