public abstract class AbstractExtendedPropertySet<T extends PropertySet> extends java.lang.Object implements PropertySet
Modifier and Type | Field and Description |
---|---|
protected T |
local |
protected T |
parent |
EMPTY
Modifier | Constructor and Description |
---|---|
protected |
AbstractExtendedPropertySet()
Protected, because only sub classes can set the data.
|
|
AbstractExtendedPropertySet(T local,
T parent)
Use the static function if you want to optionally create this only when necessary.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Property<?> prop) |
<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 |
getExtension()
This returns an object that represents the value only for the most "local" level.
|
protected <T> T |
getImpl(Property<T> prop,
T orElse,
boolean orDefault) |
T |
getLocal() |
protected T |
getOrCreateLocal() |
<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. |
T |
getParent() |
<T> T |
getParentProperty(Property<T> prop) |
java.util.Collection<Property<?>> |
getProperties() |
java.util.List<PropertyValue> |
getValues() |
protected abstract T |
instantiateLocal() |
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,
boolean localDefinitionsOnly)
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 |
setImpl(Property prop,
java.lang.Object val) |
void |
setLocal(T value) |
void |
setParent(T value) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
builder, extend, newDefaultInstance, newExtension
protected T extends PropertySet parent
protected T extends PropertySet local
public AbstractExtendedPropertySet(T local, T parent)
protected AbstractExtendedPropertySet()
public T getLocal()
public T getParent()
public void setLocal(T value)
public void setParent(T value)
protected <T> T getImpl(Property<T> prop, T orElse, boolean orDefault)
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)
protected abstract T instantiateLocal()
protected T getOrCreateLocal()
public <T> void set(Property<T> prop, T value)
set
in interface MutablePropertyValueSource
public void set(PropertyValue propValue)
set
in interface MutablePropertyValueSource
protected void setImpl(Property prop, java.lang.Object val)
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 PropertyValueSource
public java.util.List<PropertyValue> getValues()
getValues
in interface PropertyValueSource
public java.util.Iterator<PropertyValue> iterator()
iterator
in interface java.lang.Iterable<PropertyValue>
public boolean isExtended(Property<?> prop)
PropertySet
isExtended
in interface PropertySet
public boolean isInherited(Property<?> prop)
PropertySet
isInherited
in interface PropertySet
public PropertySet getExtension()
Extendable
getExtension
in interface Extendable<PropertySet>
getExtension
in interface PropertySet
public java.lang.String toString()
toString
in class java.lang.Object
public void merge(PropertySet other, boolean localDefinitionsOnly)
Mergable
merge
in interface Mergable<PropertySet>
merge
in interface MutablePropertyValueSource