public class ValueSet extends Object implements Serializable
Set
instance that models properties specific
to value sets as used by the Elasticsearch Query Language.
Every instance of this class has an AggregationType
that describes how the elements of this class are to be
interpreted.
Modifier and Type | Class and Description |
---|---|
static class |
ValueSet.AggregationType
Sets values are obligatory(
ValueSet.AggregationType.AND ) or requires
non-empty intersection (ValueSet.AggregationType.OR ). |
Constructor and Description |
---|
ValueSet(ValueSet.AggregationType aggregationType)
Creates an empty value set with the given
ValueSet.AggregationType . |
Modifier and Type | Method and Description |
---|---|
ValueSet |
add(String value)
Adds a value to this
ValueSet instance. |
ValueSet |
addAll(Collection collection)
Adds string representations of all elements of the given collection to
this
ValueSet . |
ValueSet |
clear()
Removes all values from this
ValueSet instance. |
boolean |
contains(String value)
Determines whether the given value is present in this
ValueSet
instance. |
boolean |
equals(Object o) |
ValueSet.AggregationType |
getAggregationType()
Returns the
ValueSet.AggregationType of this ValueSet . |
int |
hashCode() |
boolean |
isEmpty()
Tells whether this value set is empty.
|
ValueSet |
remove(String value)
Removes a value from this
ValueSet instance. |
void |
setAggregationType(ValueSet.AggregationType aggregationType)
Sets the
ValueSet.AggregationType of this ValueSet . |
int |
size()
Returns the size of this
ValueSet instance. |
String |
toString()
Returns a string presentation of this
ValueSet instance. |
void |
toStringBuilder(StringBuilder builder)
Appends the string presentation of this
ValueSet to the given
StringBuilder . |
String[] |
values()
Returns an array containing all values in this
ValueSet . |
Set |
valueSet()
|
public ValueSet(ValueSet.AggregationType aggregationType)
ValueSet.AggregationType
.aggregationType
- The aggregation type for this set; will become relevant once
the set is populated.public ValueSet.AggregationType getAggregationType()
ValueSet.AggregationType
of this ValueSet
.setAggregationType(AggregationType)
public void setAggregationType(ValueSet.AggregationType aggregationType)
ValueSet.AggregationType
of this ValueSet
.aggregationType
- The new aggregation type of this value set.IllegalArgumentException
- If aggregationType is null
.getAggregationType()
public String toString()
ValueSet
instance.
The returned representation is consistent with the value set syntax used for location criteria.
toString
in class Object
ValueSet
.toStringBuilder(StringBuilder)
public void toStringBuilder(StringBuilder builder)
ValueSet
to the given
StringBuilder
.
The output string representation is identical to the result of a call to
toString()
.
builder
- The buffer to which the string representation is to be added.toString()
public int size()
ValueSet
instance.public ValueSet clear()
ValueSet
instance.ValueSet
instance; useful for chained manipulations.public boolean contains(String value)
ValueSet
instance.value
- The value for which to perform a membership test.true
if the value is contained in the set, false
otherwise.public ValueSet add(String value)
ValueSet
instance.value
- The value that is to be added, if not already present.ValueSet
instance; useful for chained manipulations.IllegalArgumentException
- If value is null
or the empty string.public ValueSet remove(String value)
ValueSet
instance.value
- The value that is to be removed, if present.ValueSet
instance; useful for chained manipulations.public String[] values()
ValueSet
.ValueSet
instance.public Set valueSet()
Set
that contains all values of this
ValueSet
.
Note: for backwards compatibility reasons the return
type of this method is Set
. Callers of this method may however
assume that this method returns a SortedSet
.
Actually changing the return type would require recompilation of code
that calls this method; as such we have (for now) refrained from doing
so.
public ValueSet addAll(Collection collection)
ValueSet
.collection
- The elements that are to be added.ValueSet
instance; useful for chained manipulations.IllegalArgumentException
- If an element of collection is null
or the
empty string.public boolean isEmpty()
true
if this value set does not contain any elements;
false
otherwise.Copyright © 2021 RWS Group for and on behalf of its affiliates and subsidiaries. All rights reserved.