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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIn case thisResultElementis 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 thisResultElementis 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.booleanIn case thisResultElementis 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.byteasByte()In case thisResultElementis 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.charIn case thisResultElementis 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.doubleasDouble()In case thisResultElementis 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.floatasFloat()In case thisResultElementis 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.intIn case thisResultElementis 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.longasLong()In case thisResultElementis 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.shortasShort()In case thisResultElementis 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 thisResultElementis 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 booleanCollects elements inside thisResultCollectionidentified byfilterNameand returns aCollectedResultCollectionthat contains only the collected elements.booleanReturns thisResultElementas an instance ofResultCollection.Returns thisResultElementas an instance ofResultObject.Returns thisResultElementas an instance ofResultPrimitive.inthashCode()booleanChecks whether thisResultElementrepresents a collection of result elements and, therefore, is aResultCollection.booleanChecks whether thisResultElementrepresents a structured object and, therefore, is aResultObject.booleanChecks whether thisResultElementrepresents an unstructured value and, therefore, is aResultPrimitive.iterator()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DefaultResultCollection
-
-
Method Details
-
collect
Description copied from interface:ResultCollectionCollects elements inside thisResultCollectionidentified byfilterNameand returns aCollectedResultCollectionthat contains only the collected elements.- Specified by:
collectin interfaceResultCollection- Parameters:
elementName- The name used to identify the items to collect.- Returns:
- Instance of
CollectedResultCollectionthat 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:
asListin 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:
asSetin 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:
asBooleanListin 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:
asBooleanSetin 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:
asByteListin 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:
asByteSetin 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:
asCharacterListin 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:
asCharacterSetin 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:
asStringListin 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:
asStringSetin 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:
asIntegerListin 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:
asIntegerSetin 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:
asShortListin 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:
asShortSetin 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:
asLongListin 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:
asLongSetin 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:
asFloatListin 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:
asFloatSetin 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:
asDoubleListin 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:
asDoubleSetin 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:
asBigIntegerListin 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:
asBigIntegerSetin 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:
asBigDecimalListin 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:
asBigDecimalSetin 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:ResultElementChecks whether thisResultElementrepresents an unstructured value and, therefore, is aResultPrimitive.- Specified by:
isResultPrimitivein interfaceResultElement- Returns:
- True of this object is a
ResultPrimitive, otherwise false.
-
isResultCollection
public boolean isResultCollection()Description copied from interface:ResultElementChecks whether thisResultElementrepresents a collection of result elements and, therefore, is aResultCollection.- Specified by:
isResultCollectionin interfaceResultElement- Returns:
- True of this object is a
ResultCollection, otherwise false.
-
isResultObject
public boolean isResultObject()Description copied from interface:ResultElementChecks whether thisResultElementrepresents a structured object and, therefore, is aResultObject.- Specified by:
isResultObjectin interfaceResultElement- Returns:
- True of this object is a
ResultObject, otherwise false.
-
getAsPrimitive
Description copied from interface:ResultElementReturns thisResultElementas an instance ofResultPrimitive.- Specified by:
getAsPrimitivein interfaceResultElement- Returns:
- An instance of
ResultPrimitive. - Throws:
UnsupportedOperationException- If the cast intoResultPrimitivefailed, e.g. in case it is not a primitive.
-
getAsCollection
Description copied from interface:ResultElementReturns thisResultElementas an instance ofResultCollection.- Specified by:
getAsCollectionin interfaceResultElement- Returns:
- An instance of
ResultCollection.
-
getAsObject
Description copied from interface:ResultElementReturns thisResultElementas an instance ofResultObject.- Specified by:
getAsObjectin interfaceResultElement- Returns:
- An instance of
ResultObject. - Throws:
UnsupportedOperationException- If the cast intoResultObjectfailed, e.g. in case it is not an object.
-
asBoolean
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asboolean.- Specified by:
asBooleanin interfaceResultElement- Returns:
booleanvalue.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asboolean.
-
asByte
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asbyte.- Specified by:
asBytein interfaceResultElement- Returns:
bytevalue.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asbyte.
-
asCharacter
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value aschar.- Specified by:
asCharacterin interfaceResultElement- Returns:
charvalue.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented aschar.
-
asString
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asString.- Specified by:
asStringin interfaceResultElement- Returns:
Stringobject.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asString.
-
asInteger
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asint.- Specified by:
asIntegerin interfaceResultElement- Returns:
intvalue.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asint.
-
asShort
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asshort.- Specified by:
asShortin interfaceResultElement- Returns:
shortvalue.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asshort.
-
asLong
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value aslong.- Specified by:
asLongin interfaceResultElement- Returns:
longvalue.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented aslong.
-
asFloat
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asfloat.- Specified by:
asFloatin interfaceResultElement- Returns:
floatvalue.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asfloat.
-
asDouble
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asdouble.- Specified by:
asDoublein interfaceResultElement- Returns:
doublevalue.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asdouble.
-
asBigInteger
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asBigInteger.- Specified by:
asBigIntegerin interfaceResultElement- Returns:
BigIntegerobject.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asBigInteger.
-
asBigDecimal
Description copied from interface:ResultElementIn case thisResultElementis considered aResultPrimitive, use this method to access its value asBigDecimal.- Specified by:
asBigDecimalin interfaceResultElement- Returns:
BigDecimalobject.- Throws:
UnsupportedOperationException- If thisResultElementis not considered aResultPrimitiveor its value cannot be represented asBigDecimal.
-
iterator
- Specified by:
iteratorin interfaceIterable<ResultElement>
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
getResultElements
-