Class StructuredList
java.lang.Object
net.visma.autopay.http.structured.StructuredList
- All Implemented Interfaces:
StructuredCollection
,StructuredField
Class representing Structured Lists
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares the specified object with this Structured List for equality.int
hashCode()
Returns hash code for this Structured List.<T extends StructuredItem>
List<T>itemList()
ReturnsList
of Structured Items stored in this Structured List<T extends StructuredItem>
List<List<T>>listList()
Returns this list with Inner List values converted toList
ofStructuredItem
objects.static StructuredList
Creates Structured List from given objects.static StructuredList
of
(Collection<?> objects) Creates Structured List from given Collection elements.static StructuredList
Parses given string for Structured List, according to the specificationstatic StructuredList
parse
(Collection<String> httpHeaders) Parses given HTTP header values for Structured List, according to the specificationSerializes this Structured List to a String, according to the specification.toString()
Returns the string representation of this Structured List, which is the same as serialized representation.Methods inherited from interface net.visma.autopay.http.structured.StructuredCollection
bigDecimalList, boolList, bytesList, doubleList, intList, isEmpty, itemList, longList, stringList
-
Method Details
-
of
Creates Structured List from given Collection elements.Provided objects are converted to Structured Items without parameters or used directly if they are instances of
StructuredItem
. Strings are converted toStructuredString
. For tokens, useStructuredToken
. For supported value types see the table below.If collection element is a
StructuredItem
then it's used directly. Otherwise, the following conversion rules apply.Conversion rules Java class StructuredItem class Long
Integer
Short
Byte
StructuredInteger
BigDecimal
Double
Float
StructuredDecimal
Boolean
StructuredBoolean
byte[] StructuredBytes
String
StructuredString
Collection
StructuredInnerList
Enum
StructuredToken
- Parameters:
objects
- Collection to be converted to Structured List- Returns:
- Created Structured List
- Throws:
IllegalArgumentException
- Invalid elements
-
of
Creates Structured List from given objects.Provided objects are converted to Structured Items without parameters or used directly if they are instances of
StructuredItem
. Strings are converted toStructuredString
. For tokens, useStructuredToken
. For detailed conversion rules seeof(Collection)
.- Parameters:
objects
- Objects to be converted toStructuredList
items- Returns:
- Created Structured List
- Throws:
IllegalArgumentException
- Invalid objects provided
-
itemList
Description copied from interface:StructuredCollection
ReturnsList
of Structured Items stored in this Structured List- Specified by:
itemList
in interfaceStructuredCollection
- Type Parameters:
T
- Specific Item class if needed. No type check is performed, only simple casting.- Returns:
- Underlying list of
StructuredItem
objects
-
listList
Returns this list with Inner List values converted toList
ofStructuredItem
objects. This list must containStructuredInnerList
values only.- Type Parameters:
T
- Specific class of List members, if needed and the inner lists are homogenous- Returns:
- List with values converted to List of StructuredItem
- Throws:
ClassCastException
- Thrown if this list contains non-StructuredInnerList
values
-
serialize
Serializes this Structured List to a String, according to the specification.- Specified by:
serialize
in interfaceStructuredField
- Returns:
- Serialized representation of this Structured List
- See Also:
-
parse
Parses given string for Structured List, according to the specification- Parameters:
httpHeader
- String to parse, e.g. HTTP header- Returns:
- Parsed Structured List
- Throws:
StructuredException
- Thrown in case of malformatted string or wrong item type- See Also:
-
parse
Parses given HTTP header values for Structured List, according to the specification- Parameters:
httpHeaders
- HTTP header values, for common header name, provided in order of occurrence in HTTP message- Returns:
- Parsed Structured List
- Throws:
StructuredException
- Thrown in case of malformatted string or wrong item type- See Also:
-
equals
Compares the specified object with this Structured List for equality. Returns true if the given object is of the same class as this List, has the same value and properties. -
hashCode
public int hashCode()Returns hash code for this Structured List. The hash code is a combination of hash codes of List elements. -
toString
Returns the string representation of this Structured List, which is the same as serialized representation.
-