|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.versatile.core.AbstractValueProvider
The default implementation of the ValueProvider
interface.
It implements the chaining mechanism and all the methods which are generic,
independent of a particular attributes/values context. When extending
AbstractValueProvider
only the following three methods need be implemented:
getLocalValue()
method
hasLocalValue()
method
Field Summary | |
protected java.lang.String |
attrName
Attribute name. |
protected ValueProvider |
defaultProvider
Next-in-the-chain value provider (default). |
Constructor Summary | |
AbstractValueProvider(java.lang.String attrName,
ValueProvider defaultValue)
Public Constructor |
Method Summary | |
java.lang.String |
getAttributeName()
Returns attribute name. |
ValueProvider |
getDefault()
Returns the next ValueProvider in the chain. |
java.lang.Object |
getValue()
Returns attribute value. |
boolean |
hasValue()
Checks whether the attribute is currently set. |
PreferenceChain |
toPreferenceChain()
Takes the current snapshot of the ValueProvider chain returning a list of values
in the ValueProvider chain. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.versatile.api.ValueProvider |
getLocalValue, hasLocalValue |
Field Detail |
protected java.lang.String attrName
getAttributeName()
protected ValueProvider defaultProvider
getDefault()
Constructor Detail |
public AbstractValueProvider(java.lang.String attrName, ValueProvider defaultValue)
attrName
- an attribute name in a given attributes/values contextdefaultValue
- a default value provider (fall-back), can be null
Method Detail |
public final java.lang.String getAttributeName()
ValueProvider
getAttributeName
in interface ValueProvider
ValueProvider
is bound to.ValueProvider.getAttributeName()
public final java.lang.Object getValue()
ValueProvider
ValueProvider
instances.)
getValue
in interface ValueProvider
ValueProvider.getValue()
public final boolean hasValue()
ValueProvider
ValueProvider
instances.)
hasValue
in interface ValueProvider
true
if the value is set for any ValueProvider
in the chain,
false
otherwiseValueProvider.hasValue()
public final ValueProvider getDefault()
ValueProvider
ValueProvider
in the chain.
getDefault
in interface ValueProvider
ValueProvider
in the chain or null
when invoked for the tail of the chain.ValueProvider.getDefault()
public PreferenceChain toPreferenceChain()
ValueProvider
ValueProvider
chain returning a list of values
in the ValueProvider
chain. A value is appended to the chain for those
value providers, where hasLocaleValue()
returns true
.
Remarks: Any item in the result PreferenceChain
can be the desired property value
as well as a PreferenceChain
or a PreferenceBag
of property values
as returned by an individual ValueProvider
in the chain.
The purpose of this method is mainly for diagnostics (tuning and debugging).
toPreferenceChain
in interface ValueProvider
PreferenceChain
object - a list of values - can be an empty list.ValueProvider.toPreferenceChain()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |