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.
|
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() |
forEach, spliterator
public DefaultResultCollection(Iterable<ResultElement> resultElements)
public CollectedResultCollection collect(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 collectCollectedResultCollection
that contains only the collected elements.public <T> List<T> asList(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 toobjectType
- 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.public <T> Set<T> asSet(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 toobjectType
- 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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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 falsepublic boolean isResultCollection()
ResultElement
ResultElement
represents a collection of result elements and, therefore, is a
ResultCollection
.isResultCollection
in interface ResultElement
ResultCollection
, otherwise falsepublic boolean isResultObject()
ResultElement
ResultElement
represents a structured object and, therefore, is a
ResultObject
.isResultObject
in interface ResultElement
ResultObject
, otherwise falsepublic 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 primitivepublic ResultCollection getAsCollection()
ResultElement
ResultElement
as an instance of ResultCollection
.getAsCollection
in interface ResultElement
ResultCollection
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 objectpublic boolean asBoolean() throws UnsupportedOperationException
ResultElement
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as boolean
.asBoolean
in interface ResultElement
boolean
valueUnsupportedOperationException
- 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
valueUnsupportedOperationException
- 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
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as char
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
objectUnsupportedOperationException
- 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
valueUnsupportedOperationException
- 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
valueUnsupportedOperationException
- 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
valueUnsupportedOperationException
- 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
valueUnsupportedOperationException
- 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
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as double
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
objectUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as BigInteger
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
objectUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as BigDecimal
public Iterator<ResultElement> iterator()
iterator
in interface Iterable<ResultElement>
public Iterable<ResultElement> getResultElements()
Copyright © 2018 SAP SE. All rights reserved.