|
Carrot2 v3.6.0-SNAPSHOT
API Documentation |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.util.attribute.AttributeValueSet
public class AttributeValueSet
Maintains a named set of attribute values. Allows one AttributeValueSet (A) to
be "based" on another AttributeValueSet (B), whereby the main
AttributeValueSet (A) inherits all values from the base
AttributeValueSet (B) and can override some of them. Any depth of the base
attribute sets hierarchy is possible.
| Field Summary | |
|---|---|
String |
description
Human-readable description of this attribute value set. |
String |
label
Human-readable value of this attribute value set. |
| Constructor Summary | |
|---|---|
AttributeValueSet(String label)
Creates a new empty AttributeValueSet with a null description
and a null base attribute value set. |
|
AttributeValueSet(String label,
AttributeValueSet base)
Creates a new empty AttributeValueSet with a null description. |
|
AttributeValueSet(String label,
String description,
AttributeValueSet base)
Creates a new empty AttributeValueSet. |
|
| Method Summary | |
|---|---|
Object |
getAttributeValue(String key)
Returns value of the attribute with the provided key. |
Map<String,Object> |
getAttributeValues()
Returns attribute values defined by this AttributeValueSet and all other
AttributeValueSets that this set is based on. |
static Map<String,Object> |
getAttributeValues(AttributeValueSet attributeValueSet)
Returns attribute values from the provided AttributeValueSet or
null if the provided AttributeValueSet is null. |
Object |
setAttributeValue(String key,
Object value)
Sets a value corresponding to the provided key in this
attribute value set. |
void |
setAttributeValues(Map<String,Object> values)
Copies all values to this attribute value set. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public String label
public String description
| Constructor Detail |
|---|
public AttributeValueSet(String label)
AttributeValueSet with a null description
and a null base attribute value set.
label - human-readable label for this attribute value set
public AttributeValueSet(String label,
AttributeValueSet base)
AttributeValueSet with a null description.
label - human-readable label for this attribute value setbase - the attribute value set this set should be based on.
public AttributeValueSet(String label,
String description,
AttributeValueSet base)
AttributeValueSet.
label - human-readable label for this attribute value setdescription - human-readable description for this attribute value set, can be
nullbase - the attribute value set this set should be based on, can be
null.| Method Detail |
|---|
public Object getAttributeValue(String key)
key. Attribute values
are resolved in the following order:
key set
by {setAttributeValue(String, Object) or setAttributeValues(Map),
the value is returned.null, attribute
value is retrieved from the base set by calling the same method on it. If any of
the base attribute sets in the hierarchy contains a value for the provided key,
that value is returned.null is returned.
key - key of the attribute for which value is to be returned
null.public Map<String,Object> getAttributeValues()
AttributeValueSet and all other
AttributeValueSets that this set is based on. The returned map is
independent of this AttributeValueSet, so any modifications to that map
will not be reflected in this AttributeValueSet.
public Object setAttributeValue(String key,
Object value)
value corresponding to the provided key in this
attribute value set. If the set previously contained some value under the provided
key, that value is returned. Values set using this method override
values found in the base attribute sets of this set.
key - attribute keyvalue - attribute value
nullpublic void setAttributeValues(Map<String,Object> values)
values to this attribute value set. If this attribute value
set already contains mappings for some of the provided key, the mappings will be
overwritten. Values set using this method override values found in the base
attribute sets of this set.
values - values to be set on this attribute value set.public static Map<String,Object> getAttributeValues(AttributeValueSet attributeValueSet)
AttributeValueSet or
null if the provided AttributeValueSet is null.
public String toString()
toString in class Object
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||