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 TypeMethodDescriptionbooleanCompares the specified object with this Structured List for equality.inthashCode()Returns hash code for this Structured List.<T extends StructuredItem>
List<T>itemList()ReturnsListof Structured Items stored in this Structured List<T extends StructuredItem>
List<List<T>>listList()Returns this list with Inner List values converted toListofStructuredItemobjects.static StructuredListCreates Structured List from given objects.static StructuredListof(Collection<?> objects) Creates Structured List from given Collection elements.static StructuredListParses given string for Structured List, according to the specificationstatic StructuredListparse(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
StructuredItemthen it's used directly. Otherwise, the following conversion rules apply.Conversion rules Java class StructuredItem class LongIntegerShortByteStructuredIntegerBigDecimalDoubleFloatStructuredDecimalBooleanStructuredBooleanbyte[] StructuredBytesStringStructuredStringCollectionStructuredInnerListEnumStructuredToken- 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 toStructuredListitems- Returns:
- Created Structured List
- Throws:
IllegalArgumentException- Invalid objects provided
-
itemList
Description copied from interface:StructuredCollectionReturnsListof Structured Items stored in this Structured List- Specified by:
itemListin interfaceStructuredCollection- Type Parameters:
T- Specific Item class if needed. No type check is performed, only simple casting.- Returns:
- Underlying list of
StructuredItemobjects
-
listList
Returns this list with Inner List values converted toListofStructuredItemobjects. This list must containStructuredInnerListvalues 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-StructuredInnerListvalues
-
serialize
Serializes this Structured List to a String, according to the specification.- Specified by:
serializein 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.
-