public abstract class Value extends Object implements Cloneable
Constructor and Description |
---|
Value()
Default constructor.
|
Value(String prop)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addEquivalentKey(String other)
Adds a moniker that is equivalent to the original property key used
during construction.
|
void |
addListener(ValueListener listener)
Listener for value changes.
|
String |
alias(String str)
Alias the given setting.
|
protected String |
alias(String str,
String[] aliases,
boolean nullNotFound)
Alias the given setting.
|
protected void |
assertChangeable()
Asserts if this receiver can be changed.
|
Object |
clone() |
boolean |
equals(Object other)
Use
original value instead of
current value because they are one and the same
for non-dynamic Values and ensures that modifying dynamic Values do not
impact equality or hashCode contract. |
abstract Object |
get()
Get the actual data stored in this value.
|
String[] |
getAliases()
Aliases for the value in the form key1, value1, key2, value2, ...
|
String |
getDefault()
The default value for the property as a string.
|
Set<String> |
getEquivalentKeys()
Gets the unmodifiable view of the equivalent keys or an empty set if
no equivalent key has been added.
|
String |
getInstantiatingGetter()
The name of the getter method for the instantiated value of this
property(as opposed to the string value)
|
protected abstract String |
getInternalString()
Return the internal string form of this value.
|
List<ValueListener> |
getListeners()
Gets unmodifable list of listeners for value changes.
|
String |
getLoadKey()
The key under which this value was loaded, or null.
|
String |
getOriginalValue()
Gets the original value.
|
String |
getProperty()
The property name that will be used when setting or
getting this value in a
Map . |
List<String> |
getPropertyKeys()
Gets unmodifiable view of all the property keys set on this receiver.
|
Class |
getScope()
A class defining the scope in which this value is defined.
|
String |
getString()
Return a stringified version of this value.
|
abstract Class<?> |
getValueType()
Returns the type of the property that this Value represents.
|
int |
hashCode()
Use
original value instead of
current value because they are one and the same
for non-dynamic Values and ensures that modifying dynamic Values do not
impact equality or hashCode contract. |
void |
hide()
Hides the value of this Value from being output to the caller.
|
boolean |
isAliasListComprehensive()
Whether or not the alias list defines all possible settings for this
value.
|
boolean |
isDynamic()
Affirms if this receiver can be mutated even when the configuration it
belongs to has been
frozen . |
boolean |
isHidden()
Affirms if the value for this Value is visible.
|
boolean |
isPrivate()
Affirms if this Value is used for internal purpose only and not exposed as a supported property.
|
void |
makePrivate()
Marks this Value for internal purpose only.
|
boolean |
matches(String p)
Affirms if the given key matches the property (or any of its equivalent).
|
void |
removeListener(ValueListener listener) |
void |
setAlias(String key,
String value)
Replaces an existing alias, or adds the given alias to the front of the
alias list if it does not already exist.
|
protected String[] |
setAlias(String key,
String value,
String[] aliases)
Set an alias into a current alias list, returning the new list.
|
void |
setAliases(String[] aliases)
Aliases for the value in the form key1, value1, key2, value2, ...
|
void |
setAliasListComprehensive(boolean aliasListIsComprehensive)
Whether or not the alias list defines all possible settings for this
value.
|
void |
setDefault(String def)
The default value for the property as a string.
|
void |
setDynamic(boolean flag)
Sets if this receiver can be mutated even when the configuration it
belongs to has been
frozen . |
void |
setInstantiatingGetter(String getter)
The name of the getter method for the instantiated value of this
property(as opposed to the string value).
|
protected abstract void |
setInternalObject(Object obj)
Set this value from an object.
|
protected abstract void |
setInternalString(String str)
Set this value from the given string.
|
void |
setLoadKey(String key)
Sets key under which this value was loaded.
|
void |
setObject(Object obj)
Set this value as an object.
|
void |
setProperty(String prop)
The property name that will be used when setting or
getting this value in a
Map . |
void |
setScope(Class cls)
A class defining the scope in which this value is defined.
|
void |
setString(String val)
Set this value from the given string.
|
String |
toString() |
String |
unalias(String str)
Unalias the given setting.
|
protected String |
unalias(String str,
String[] aliases,
boolean nullNotFound)
Unalias the given setting.
|
void |
valueChanged()
Subclasses should call this method when their internal value changes.
|
public static final String INVISIBLE
public Value()
public Value(String prop)
setProperty(java.lang.String)
public String getProperty()
Map
.public void setProperty(String prop)
Map
.public void addEquivalentKey(String other)
public Set<String> getEquivalentKeys()
public List<String> getPropertyKeys()
getProperty()
method.public boolean matches(String p)
public String getLoadKey()
public void setLoadKey(String key)
if
- called with a non-null key which is different from an
already loaded key.public String[] getAliases()
public void setAliases(String[] aliases)
To avoid potential side-effects, this method copies the array passed in.
public void setAlias(String key, String value)
protected String[] setAlias(String key, String value, String[] aliases)
public boolean isAliasListComprehensive()
public void setAliasListComprehensive(boolean aliasListIsComprehensive)
protected String alias(String str, String[] aliases, boolean nullNotFound)
protected String unalias(String str, String[] aliases, boolean nullNotFound)
public String getDefault()
public void setDefault(String def)
public String getInstantiatingGetter()
public void setInstantiatingGetter(String getter)
this.
, then the getter will be looked up on the value
instance itself. Otherwise, the getter will be looked up on the
configuration instance.public Class getScope()
public void setScope(Class cls)
public String getString()
public void setString(String val)
originalString
being null), then the
value is remembered as original. This original value is used
for equality and hashCode computation if this Value is
dynamic
.public void setObject(Object obj)
originalString
being null), then the
value is remembered as original. This original value is used
for equality and hashCode computation if this Value is
dynamic
.public String getOriginalValue()
public abstract Class<?> getValueType()
protected abstract String getInternalString()
protected abstract void setInternalString(String str)
protected abstract void setInternalObject(Object obj)
public List<ValueListener> getListeners()
public void addListener(ValueListener listener)
public void removeListener(ValueListener listener)
public void valueChanged()
protected void assertChangeable()
public void setDynamic(boolean flag)
frozen
.public boolean isDynamic()
frozen
.public int hashCode()
original value
instead of
current value
because they are one and the same
for non-dynamic Values and ensures that modifying dynamic Values do not
impact equality or hashCode contract.public boolean equals(Object other)
original value
instead of
current value
because they are one and the same
for non-dynamic Values and ensures that modifying dynamic Values do not
impact equality or hashCode contract.public boolean isHidden()
public void hide()
public boolean isPrivate()
Configuration.getPropertyKeys()
public void makePrivate()
public abstract Object get()
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.