Package com.sap.cloud.sdk.result
Class DefaultResultCollection
java.lang.Object
com.sap.cloud.sdk.result.DefaultResultCollection
- All Implemented Interfaces:
ResultCollection
,ResultElement
,Iterable<ResultElement>
This class provides an abstraction of a collection of result elements
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionIn case thisResultElement
is considered aResultPrimitive
, use this method to access its value asBigDecimal
.Returns a list of values from this instance.Returns a set of values from this instance.In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asBigInteger
.Returns a list of values from this instance.Returns a set of values from this instance.boolean
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asboolean
.Returns a list of values from this instance.Returns a set of values from this instance.byte
asByte()
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asbyte
.Returns a list of values from this instance.Returns a set of values from this instance.char
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value aschar
.Returns a list of values from this instance.Returns a set of values from this instance.double
asDouble()
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asdouble
.Returns a list of values from this instance.Returns a set of values from this instance.float
asFloat()
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asfloat
.Returns a list of values from this instance.Returns a set of values from this instance.int
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asint
.Returns a list of values from this instance.Returns a set of values from this instance.<T> List<T>
Returns a list of values from this instance.long
asLong()
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value aslong
.Returns a list of values from this instance.Returns a set of values from this instance.<T> Set<T>
Returns a set of values from this instance.short
asShort()
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asshort
.Returns a list of values from this instance.Returns a set of values from this instance.asString()
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asString
.Returns a list of values from this instance.Returns a set of values from this instance.protected boolean
Collects elements inside thisResultCollection
identified byfilterName
and returns aCollectedResultCollection
that contains only the collected elements.boolean
Returns thisResultElement
as an instance ofResultCollection
.Returns thisResultElement
as an instance ofResultObject
.Returns thisResultElement
as an instance ofResultPrimitive
.int
hashCode()
boolean
Checks whether thisResultElement
represents a collection of result elements and, therefore, is aResultCollection
.boolean
Checks whether thisResultElement
represents a structured object and, therefore, is aResultObject
.boolean
Checks whether thisResultElement
represents an unstructured value and, therefore, is aResultPrimitive
.iterator()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DefaultResultCollection
-
-
Method Details
-
collect
Description copied from interface:ResultCollection
Collects elements inside thisResultCollection
identified byfilterName
and returns aCollectedResultCollection
that contains only the collected elements.- Specified by:
collect
in interfaceResultCollection
- Parameters:
elementName
- The name used to identify the items to collect.- Returns:
- Instance of
CollectedResultCollection
that contains only the collected elements.
-
asList
@Nonnull public <T> List<T> asList(@Nonnull Class<T> objectType) throws UnsupportedOperationException Returns a list of values from this instance. The values are represented as an object of the given type.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; }
- Specified by:
asList
in interfaceResultCollection
- Type Parameters:
T
- The type the elements in this collection object shall be casted to.- Parameters:
objectType
- The type into which the values should be converted.- Returns:
- The list of values as objects of type
T
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asSet
Returns a set of values from this instance. The values are represented as an object of the given type.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; }
- Specified by:
asSet
in interfaceResultCollection
- Type Parameters:
T
- The type the elements in this collection object shall be casted to.- Parameters:
objectType
- The type into which the values should be converted.- Returns:
- The set of values as objects of type
T
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asBooleanList
Returns a list of values from this instance. The values are represented asBoolean
.- Specified by:
asBooleanList
in interfaceResultCollection
- Returns:
- The list of values as
Boolean
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asBooleanSet
Returns a set of values from this instance. The values are represented asBoolean
.- Specified by:
asBooleanSet
in interfaceResultCollection
- Returns:
- The set of values as
Boolean
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asByteList
Returns a list of values from this instance. The values are represented asByte
.- Specified by:
asByteList
in interfaceResultCollection
- Returns:
- The list of values as
Byte
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asByteSet
Returns a set of values from this instance. The values are represented asByte
.- Specified by:
asByteSet
in interfaceResultCollection
- Returns:
- The set of values as
Byte
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asCharacterList
Returns a list of values from this instance. The values are represented asCharacter
.- Specified by:
asCharacterList
in interfaceResultCollection
- Returns:
- The list of values as
Character
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asCharacterSet
Returns a set of values from this instance. The values are represented asCharacter
.- Specified by:
asCharacterSet
in interfaceResultCollection
- Returns:
- The set of values as
Character
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asStringList
Returns a list of values from this instance. The values are represented asString
.- Specified by:
asStringList
in interfaceResultCollection
- Returns:
- The list of values as
String
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asStringSet
Returns a set of values from this instance. The values are represented asString
.- Specified by:
asStringSet
in interfaceResultCollection
- Returns:
- The set of values as
String
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asIntegerList
Returns a list of values from this instance. The values are represented asInteger
.- Specified by:
asIntegerList
in interfaceResultCollection
- Returns:
- The list of values as
Integer
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asIntegerSet
Returns a set of values from this instance. The values are represented asInteger
.- Specified by:
asIntegerSet
in interfaceResultCollection
- Returns:
- The set of values as
Integer
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asShortList
Returns a list of values from this instance. The values are represented asShort
.- Specified by:
asShortList
in interfaceResultCollection
- Returns:
- The list of values as
Short
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asShortSet
Returns a set of values from this instance. The values are represented asShort
.- Specified by:
asShortSet
in interfaceResultCollection
- Returns:
- The set of values as
Short
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asLongList
Returns a list of values from this instance. The values are represented asLong
.- Specified by:
asLongList
in interfaceResultCollection
- Returns:
- The list of values as
Long
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asLongSet
Returns a set of values from this instance. The values are represented asLong
.- Specified by:
asLongSet
in interfaceResultCollection
- Returns:
- The set of values as
Long
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asFloatList
Returns a list of values from this instance. The values are represented asFloat
.- Specified by:
asFloatList
in interfaceResultCollection
- Returns:
- The list of values as
Float
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asFloatSet
Returns a set of values from this instance. The values are represented asFloat
.- Specified by:
asFloatSet
in interfaceResultCollection
- Returns:
- The set of values as
Float
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asDoubleList
Returns a list of values from this instance. The values are represented asDouble
.- Specified by:
asDoubleList
in interfaceResultCollection
- Returns:
- The list of values as
Double
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asDoubleSet
Returns a set of values from this instance. The values are represented asDouble
.- Specified by:
asDoubleSet
in interfaceResultCollection
- Returns:
- The set of values as
Double
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asBigIntegerList
Returns a list of values from this instance. The values are represented asBigInteger
.- Specified by:
asBigIntegerList
in interfaceResultCollection
- Returns:
- The list of values as
BigInteger
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asBigIntegerSet
Returns a set of values from this instance. The values are represented asBigInteger
.- Specified by:
asBigIntegerSet
in interfaceResultCollection
- Returns:
- The set of values as
BigInteger
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asBigDecimalList
Returns a list of values from this instance. The values are represented asBigDecimal
.- Specified by:
asBigDecimalList
in interfaceResultCollection
- Returns:
- The list of values as
BigDecimal
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
asBigDecimalSet
Returns a set of values from this instance. The values are represented asBigDecimal
.- Specified by:
asBigDecimalSet
in interfaceResultCollection
- Returns:
- The set of values as
BigDecimal
. - Throws:
UnsupportedOperationException
- If the value could not be found or could not be converted to the given type.
-
isResultPrimitive
public boolean isResultPrimitive()Description copied from interface:ResultElement
Checks whether thisResultElement
represents an unstructured value and, therefore, is aResultPrimitive
.- Specified by:
isResultPrimitive
in interfaceResultElement
- Returns:
- True of this object is a
ResultPrimitive
, otherwise false.
-
isResultCollection
public boolean isResultCollection()Description copied from interface:ResultElement
Checks whether thisResultElement
represents a collection of result elements and, therefore, is aResultCollection
.- Specified by:
isResultCollection
in interfaceResultElement
- Returns:
- True of this object is a
ResultCollection
, otherwise false.
-
isResultObject
public boolean isResultObject()Description copied from interface:ResultElement
Checks whether thisResultElement
represents a structured object and, therefore, is aResultObject
.- Specified by:
isResultObject
in interfaceResultElement
- Returns:
- True of this object is a
ResultObject
, otherwise false.
-
getAsPrimitive
Description copied from interface:ResultElement
Returns thisResultElement
as an instance ofResultPrimitive
.- Specified by:
getAsPrimitive
in interfaceResultElement
- Returns:
- An instance of
ResultPrimitive
. - Throws:
UnsupportedOperationException
- If the cast intoResultPrimitive
failed, e.g. in case it is not a primitive.
-
getAsCollection
Description copied from interface:ResultElement
Returns thisResultElement
as an instance ofResultCollection
.- Specified by:
getAsCollection
in interfaceResultElement
- Returns:
- An instance of
ResultCollection
.
-
getAsObject
Description copied from interface:ResultElement
Returns thisResultElement
as an instance ofResultObject
.- Specified by:
getAsObject
in interfaceResultElement
- Returns:
- An instance of
ResultObject
. - Throws:
UnsupportedOperationException
- If the cast intoResultObject
failed, e.g. in case it is not an object.
-
asBoolean
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asboolean
.- Specified by:
asBoolean
in interfaceResultElement
- Returns:
boolean
value.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asboolean
.
-
asByte
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asbyte
.- Specified by:
asByte
in interfaceResultElement
- Returns:
byte
value.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asbyte
.
-
asCharacter
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value aschar
.- Specified by:
asCharacter
in interfaceResultElement
- Returns:
char
value.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented aschar
.
-
asString
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asString
.- Specified by:
asString
in interfaceResultElement
- Returns:
String
object.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asString
.
-
asInteger
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asint
.- Specified by:
asInteger
in interfaceResultElement
- Returns:
int
value.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asint
.
-
asShort
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asshort
.- Specified by:
asShort
in interfaceResultElement
- Returns:
short
value.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asshort
.
-
asLong
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value aslong
.- Specified by:
asLong
in interfaceResultElement
- Returns:
long
value.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented aslong
.
-
asFloat
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asfloat
.- Specified by:
asFloat
in interfaceResultElement
- Returns:
float
value.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asfloat
.
-
asDouble
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asdouble
.- Specified by:
asDouble
in interfaceResultElement
- Returns:
double
value.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asdouble
.
-
asBigInteger
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asBigInteger
.- Specified by:
asBigInteger
in interfaceResultElement
- Returns:
BigInteger
object.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asBigInteger
.
-
asBigDecimal
Description copied from interface:ResultElement
In case thisResultElement
is considered aResultPrimitive
, use this method to access its value asBigDecimal
.- Specified by:
asBigDecimal
in interfaceResultElement
- Returns:
BigDecimal
object.- Throws:
UnsupportedOperationException
- If thisResultElement
is not considered aResultPrimitive
or its value cannot be represented asBigDecimal
.
-
iterator
- Specified by:
iterator
in interfaceIterable<ResultElement>
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
getResultElements
-