public class DefaultResultCollection extends Object implements ResultCollection
Constructor and Description |
---|
DefaultResultCollection(Iterable<ResultElement> resultElements) |
Modifier and Type | Method and Description |
---|---|
BigDecimal |
asBigDecimal()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as BigDecimal . |
List<BigDecimal> |
asBigDecimalList()
Returns a list of values from this instance.
|
Set<BigDecimal> |
asBigDecimalSet()
Returns a set of values from this instance.
|
BigInteger |
asBigInteger()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as BigInteger . |
List<BigInteger> |
asBigIntegerList()
Returns a list of values from this instance.
|
Set<BigInteger> |
asBigIntegerSet()
Returns a set of values from this instance.
|
boolean |
asBoolean()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as boolean . |
List<Boolean> |
asBooleanList()
Returns a list of values from this instance.
|
Set<Boolean> |
asBooleanSet()
Returns a set of values from this instance.
|
byte |
asByte()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as byte . |
List<Byte> |
asByteList()
Returns a list of values from this instance.
|
Set<Byte> |
asByteSet()
Returns a set of values from this instance.
|
char |
asCharacter()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as char . |
List<Character> |
asCharacterList()
Returns a list of values from this instance.
|
Set<Character> |
asCharacterSet()
Returns a set of values from this instance.
|
double |
asDouble()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as double . |
List<Double> |
asDoubleList()
Returns a list of values from this instance.
|
Set<Double> |
asDoubleSet()
Returns a set of values from this instance.
|
float |
asFloat()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as float . |
List<Float> |
asFloatList()
Returns a list of values from this instance.
|
Set<Float> |
asFloatSet()
Returns a set of values from this instance.
|
int |
asInteger()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as int . |
List<Integer> |
asIntegerList()
Returns a list of values from this instance.
|
Set<Integer> |
asIntegerSet()
Returns a set of values from this instance.
|
<T> List<T> |
asList(Class<T> objectType)
Returns a list of values from this instance.
|
long |
asLong()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as long . |
List<Long> |
asLongList()
Returns a list of values from this instance.
|
Set<Long> |
asLongSet()
Returns a set of values from this instance.
|
<T> Set<T> |
asSet(Class<T> objectType)
Returns a set of values from this instance.
|
short |
asShort()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as short . |
List<Short> |
asShortList()
Returns a list of values from this instance.
|
Set<Short> |
asShortSet()
Returns a set of values from this instance.
|
String |
asString()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as String . |
List<String> |
asStringList()
Returns a list of values from this instance.
|
Set<String> |
asStringSet()
Returns a set of values from this instance.
|
protected boolean |
canEqual(Object other) |
CollectedResultCollection |
collect(String elementName)
Collects elements inside this
ResultCollection identified by filterName and returns a
CollectedResultCollection that contains only the collected elements. |
boolean |
equals(Object o) |
ResultCollection |
getAsCollection()
Returns this
ResultElement as an instance of ResultCollection . |
ResultObject |
getAsObject()
Returns this
ResultElement as an instance of ResultObject . |
ResultPrimitive |
getAsPrimitive()
Returns this
ResultElement as an instance of ResultPrimitive . |
Iterable<ResultElement> |
getResultElements() |
int |
hashCode() |
boolean |
isResultCollection()
Checks whether this
ResultElement represents a collection of result elements and, therefore, is a
ResultCollection . |
boolean |
isResultObject()
Checks whether this
ResultElement represents a structured object and, therefore, is a
ResultObject . |
boolean |
isResultPrimitive()
Checks whether this
ResultElement represents an unstructured value and, therefore, is a
ResultPrimitive . |
Iterator<ResultElement> |
iterator() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public DefaultResultCollection(Iterable<ResultElement> resultElements)
@Nonnull public CollectedResultCollection collect(@Nonnull String elementName)
ResultCollection
ResultCollection
identified by filterName
and returns a
CollectedResultCollection
that contains only the collected elements.collect
in interface ResultCollection
elementName
- The name used to identify the items to collect.CollectedResultCollection
that contains only the collected elements.@Nonnull public <T> List<T> asList(@Nonnull Class<T> objectType) throws UnsupportedOperationException
Important: In order to deserialize a result element to an object of a given type, you have to
annotate all relevant field members of the respective class with ElementName
. For example:
class MyObject
{
@ElementName( "MANDT" )
SapClient sapClient;
}
asList
in interface ResultCollection
T
- The type the elements in this collection object shall be casted to.objectType
- The type into which the values should be converted.T
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public <T> Set<T> asSet(@Nonnull Class<T> objectType) throws UnsupportedOperationException
Important: In order to deserialize a result element to an object of a given type, you have to
annotate all relevant field members of the respective class with ElementName
. For example:
class MyObject
{
@ElementName( "MANDT" )
SapClient sapClient;
}
asSet
in interface ResultCollection
T
- The type the elements in this collection object shall be casted to.objectType
- The type into which the values should be converted.T
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<Boolean> asBooleanList() throws UnsupportedOperationException
Boolean
.asBooleanList
in interface ResultCollection
Boolean
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<Boolean> asBooleanSet() throws UnsupportedOperationException
Boolean
.asBooleanSet
in interface ResultCollection
Boolean
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<Byte> asByteList() throws UnsupportedOperationException
Byte
.asByteList
in interface ResultCollection
Byte
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<Byte> asByteSet() throws UnsupportedOperationException
Byte
.asByteSet
in interface ResultCollection
Byte
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<Character> asCharacterList() throws UnsupportedOperationException
Character
.asCharacterList
in interface ResultCollection
Character
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<Character> asCharacterSet() throws UnsupportedOperationException
Character
.asCharacterSet
in interface ResultCollection
Character
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<String> asStringList() throws UnsupportedOperationException
String
.asStringList
in interface ResultCollection
String
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<String> asStringSet() throws UnsupportedOperationException
String
.asStringSet
in interface ResultCollection
String
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<Integer> asIntegerList() throws UnsupportedOperationException
Integer
.asIntegerList
in interface ResultCollection
Integer
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<Integer> asIntegerSet() throws UnsupportedOperationException
Integer
.asIntegerSet
in interface ResultCollection
Integer
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<Short> asShortList() throws UnsupportedOperationException
Short
.asShortList
in interface ResultCollection
Short
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<Short> asShortSet() throws UnsupportedOperationException
Short
.asShortSet
in interface ResultCollection
Short
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<Long> asLongList() throws UnsupportedOperationException
Long
.asLongList
in interface ResultCollection
Long
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<Long> asLongSet() throws UnsupportedOperationException
Long
.asLongSet
in interface ResultCollection
Long
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<Float> asFloatList() throws UnsupportedOperationException
Float
.asFloatList
in interface ResultCollection
Float
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<Float> asFloatSet() throws UnsupportedOperationException
Float
.asFloatSet
in interface ResultCollection
Float
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<Double> asDoubleList() throws UnsupportedOperationException
Double
.asDoubleList
in interface ResultCollection
Double
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<Double> asDoubleSet() throws UnsupportedOperationException
Double
.asDoubleSet
in interface ResultCollection
Double
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<BigInteger> asBigIntegerList() throws UnsupportedOperationException
BigInteger
.asBigIntegerList
in interface ResultCollection
BigInteger
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<BigInteger> asBigIntegerSet() throws UnsupportedOperationException
BigInteger
.asBigIntegerSet
in interface ResultCollection
BigInteger
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public List<BigDecimal> asBigDecimalList() throws UnsupportedOperationException
BigDecimal
.asBigDecimalList
in interface ResultCollection
BigDecimal
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.@Nonnull public Set<BigDecimal> asBigDecimalSet() throws UnsupportedOperationException
BigDecimal
.asBigDecimalSet
in interface ResultCollection
BigDecimal
.UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.public boolean isResultPrimitive()
ResultElement
ResultElement
represents an unstructured value and, therefore, is a
ResultPrimitive
.isResultPrimitive
in interface ResultElement
ResultPrimitive
, otherwise false.public boolean isResultCollection()
ResultElement
ResultElement
represents a collection of result elements and, therefore, is a
ResultCollection
.isResultCollection
in interface ResultElement
ResultCollection
, otherwise false.public boolean isResultObject()
ResultElement
ResultElement
represents a structured object and, therefore, is a
ResultObject
.isResultObject
in interface ResultElement
ResultObject
, otherwise false.@Nonnull public ResultPrimitive getAsPrimitive() throws UnsupportedOperationException
ResultElement
ResultElement
as an instance of ResultPrimitive
.getAsPrimitive
in interface ResultElement
ResultPrimitive
.UnsupportedOperationException
- If the cast into ResultPrimitive
failed, e.g. in case it is not a primitive.@Nonnull public ResultCollection getAsCollection()
ResultElement
ResultElement
as an instance of ResultCollection
.getAsCollection
in interface ResultElement
ResultCollection
.@Nonnull public ResultObject getAsObject() throws UnsupportedOperationException
ResultElement
ResultElement
as an instance of ResultObject
.getAsObject
in interface ResultElement
ResultObject
.UnsupportedOperationException
- If the cast into ResultObject
failed, e.g. in case it is not an object.public boolean asBoolean() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as boolean
.asBoolean
in interface ResultElement
boolean
value.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as boolean
.public byte asByte() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as byte
.asByte
in interface ResultElement
byte
value.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as byte
.public char asCharacter() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as char
.asCharacter
in interface ResultElement
char
value.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as char
.@Nonnull public String asString() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as String
.asString
in interface ResultElement
String
object.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as String
.public int asInteger() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as int
.asInteger
in interface ResultElement
int
value.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as int
.public short asShort() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as short
.asShort
in interface ResultElement
short
value.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as short
.public long asLong() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as long
.asLong
in interface ResultElement
long
value.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as long
.public float asFloat() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as float
.asFloat
in interface ResultElement
float
value.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as float
.public double asDouble() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as double
.asDouble
in interface ResultElement
double
value.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as double
.@Nonnull public BigInteger asBigInteger() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as BigInteger
.asBigInteger
in interface ResultElement
BigInteger
object.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as BigInteger
.@Nonnull public BigDecimal asBigDecimal() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as BigDecimal
.asBigDecimal
in interface ResultElement
BigDecimal
object.UnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as BigDecimal
.@Nonnull public Iterator<ResultElement> iterator()
iterator
in interface Iterable<ResultElement>
protected boolean canEqual(Object other)
public Iterable<ResultElement> getResultElements()
Copyright © 2020 SAP SE. All rights reserved.