-
- Type Parameters:
B- the generic type
- All Known Subinterfaces:
HeaderFields<C,B>
- All Known Implementing Classes:
AbstractHeaderFields,AbstractHttpFields,FormFields,RequestHeaderFields,ResponseHeaderFields
public interface HttpFields<B extends HttpFields<B>> extends Map<String,List<String>>
Various key/value "collections" we run across when we develop HTTP based applications may have more then one value for one key. Such "collections" in this package are theHeaderFieldsas well as theFormFields. This interface represents this kind of data structure providing some common convenience methods.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidaddTo(Enum<?> aField, String aValue)Same asaddTo(String, String)though using the provided enumeration'sEnum.toString()method to determine the key.default voidaddTo(Enum<?> aField, String... aValues)Same asaddTo(String, String ...)though using the provided enumeration'sEnum.toString()method to determine the key.default voidaddTo(Enum<?> aField, List<String> aValues)Same asaddTo(String, List)though using the provided enumeration'sEnum.toString()method to determine the key.default voidaddTo(String aField, String aValue)Adds a value to the list of values associated with the given Header-Field (key).default voidaddTo(String aField, String... aValues)Adds values to the list of values associated with the given Header-Field (key).default voidaddTo(String aField, List<String> aValues)Adds values to the list of values associated with the given Header-Field (key),.default StringgetFirst(Enum<?> aField)Same asgetFirst(String)though using the provided enumeration'sEnum.toString()method to determine the key.default StringgetFirst(String aField)Returns the first Header-Field value in the list of values associated with the given Header-Field.default List<String>put(Enum<?> aField, String aValue)Same asput(String, String)though using the provided enumeration'sEnum.toString()method to determine the key.default List<String>put(Enum<?> aField, String... aValues)Same asput(String, String ... )though using the provided enumeration'sEnum.toString()method to determine the key.default List<String>put(String aField, String aValue)Sets a single value for the Header-Field (key).default List<String>put(String aField, String... aValues)Performs a #set(String, String) on multiple values.default StringtoField(Enum<?> aField)Same astoField(String)though using the provided enumeration'sEnum.toString()method to determine the key.default StringtoField(String aKey)This method returns a singleString(instead of returning aListofStringinstances when callingMap.get(Object)) where the elements of the filed are separated by theDelimiter.HTTP_HEADER_ELEMENTSand concatenated as a singleString.default BwithAddTo(Enum<?> aField, String aValue)Same aswithAddTo(String, String)though using the provided enumeration'sEnum.toString()method to determine the key.default BwithAddTo(Enum<?> aField, String... aValues)Same aswithAddTo(String, String ...)though using the provided enumeration'sEnum.toString()method to determine the key.default BwithAddTo(Enum<?> aField, List<String> aValues)Same aswithAddTo(String, List)though using the provided enumeration'sEnum.toString()method to determine the key.default BwithAddTo(String aField, String aValue)Builder method for theaddTo(String, String)method.default BwithAddTo(String aField, String... aValues)Builder method for theaddTo(String, String...)method.default BwithAddTo(String aField, List<String> aValues)Builder method for theaddTo(String, List)method.default BwithPut(Enum<?> aField, String aValue)Same aswithPut(String, String)though using the provided enumeration'sEnum.toString()method to determine the key.default BwithPut(Enum<?> aField, String... aValues)Same aswithPut(String, String ...)though using the provided enumeration'sEnum.toString()method to determine the key.default BwithPut(Enum<?> aField, List<String> aValues)Same aswithPut(String, List)though using the provided enumeration'sEnum.toString()method to determine the key.default BwithPut(String aField, String aValue)Builder method for theput(String, String)method.default BwithPut(String aField, String... aValues)Builder method for theput(String, String...)method.default BwithPut(String aField, List<String> aValues)Builder method for theMap.put(Object, Object)method.-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Method Detail
-
getFirst
default String getFirst(String aField)
Returns the first Header-Field value in the list of values associated with the given Header-Field.- Parameters:
aField- The Header-Field (key) of which's values the first value is to be retrieved.- Returns:
- The first value in the list of values associated to the given Header-Field (key).
-
getFirst
default String getFirst(Enum<?> aField)
Same asgetFirst(String)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the field- Returns:
- the first
- See Also:
getFirst(String)
-
put
default List<String> put(String aField, String aValue)
Sets a single value for the Header-Field (key). Any values previously associated to the given Header-Field (key) are lost.- Parameters:
aField- The Header-Field for which to set a single value.aValue- The single value to be set for the Header-Field (key).- Returns:
- the list
-
put
default List<String> put(Enum<?> aField, String aValue)
Same asput(String, String)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValue- the value- Returns:
- the list
- See Also:
put(String, String)
-
put
default List<String> put(String aField, String... aValues)
Performs a #set(String, String) on multiple values.- Parameters:
aField- The Header-Field for which to set the values.aValues- The values to be set for the Header-Field (key).- Returns:
- the list
-
put
default List<String> put(Enum<?> aField, String... aValues)
Same asput(String, String ... )though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValues- the values- Returns:
- the list
- See Also:
put(String, String ...)
-
withPut
default B withPut(String aField, String aValue)
Builder method for theput(String, String)method.- Parameters:
aField- The Header-Field for which to set a single value.aValue- The single value to be set for the Header-Field (key).- Returns:
- This
HttpFieldsinstance to continue building up the Header-Fields.
-
withPut
default B withPut(Enum<?> aField, String aValue)
Same aswithPut(String, String)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValue- the value- Returns:
- the b
- See Also:
withPut(String, String)
-
withPut
default B withPut(String aField, List<String> aValues)
Builder method for theMap.put(Object, Object)method.- Parameters:
aField- The Header-Field for which to set the values.aValues- The values to be set for the Header-Field (key).- Returns:
- This
HttpFieldsinstance to continue building up the Header-Fields.
-
withPut
default B withPut(Enum<?> aField, List<String> aValues)
Same aswithPut(String, List)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValues- the values- Returns:
- the b
- See Also:
withPut(String, List)
-
withPut
default B withPut(String aField, String... aValues)
Builder method for theput(String, String...)method.- Parameters:
aField- The Header-Field for which to set the values.aValues- The values to be set for the Header-Field (key).- Returns:
- This
HttpFieldsinstance to continue building up the Header-Fields.
-
withPut
default B withPut(Enum<?> aField, String... aValues)
Same aswithPut(String, String ...)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValues- the values- Returns:
- the b
- See Also:
withPut(String, String ...)
-
addTo
default void addTo(String aField, String aValue)
Adds a value to the list of values associated with the given Header-Field (key).- Parameters:
aField- The Header-Field (key) of which's list of values a value is to be added.aValue- The value to be added to the list of values associated to the given Header-Field (key).
-
addTo
default void addTo(Enum<?> aField, String aValue)
Same asaddTo(String, String)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValue- the value- See Also:
addTo(String, String)
-
addTo
default void addTo(String aField, String... aValues)
Adds values to the list of values associated with the given Header-Field (key).- Parameters:
aField- The Header-Field (key) of which's list of values the values are to be added.aValues- The values to be added to the list of values associated to the given Header-Field (key).
-
addTo
default void addTo(Enum<?> aField, String... aValues)
Same asaddTo(String, String ...)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValues- the values- See Also:
addTo(String, String ...)
-
addTo
default void addTo(String aField, List<String> aValues)
Adds values to the list of values associated with the given Header-Field (key),.- Parameters:
aField- The Header-Field (key) of which's list of values the values are to be added.aValues- The values to be added to the list of values associated to the given Header-Field (key).
-
addTo
default void addTo(Enum<?> aField, List<String> aValues)
Same asaddTo(String, List)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValues- the values- See Also:
addTo(String, List)
-
withAddTo
default B withAddTo(String aField, String aValue)
Builder method for theaddTo(String, String)method.- Parameters:
aField- The Header-Field (key) of which's list of values a value is to be added.aValue- The value to be added to the list of values associated to the given Header-Field (key).- Returns:
- This
HttpFieldsinstance to continue building up the Header-Fields.
-
withAddTo
default B withAddTo(Enum<?> aField, String aValue)
Same aswithAddTo(String, String)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValue- the value- Returns:
- the b
- See Also:
withAddTo(String, String)
-
withAddTo
default B withAddTo(String aField, String... aValues)
Builder method for theaddTo(String, String...)method.- Parameters:
aField- The Header-Field (key) of which's list of values the values are to be added.aValues- The values to be added to the list of values associated to the given Header-Field (key).- Returns:
- This
HttpFieldsinstance to continue building up the Header-Fields.
-
withAddTo
default B withAddTo(Enum<?> aField, String... aValues)
Same aswithAddTo(String, String ...)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValues- the values- Returns:
- the b
- See Also:
withAddTo(String, String ...)
-
withAddTo
default B withAddTo(String aField, List<String> aValues)
Builder method for theaddTo(String, List)method.- Parameters:
aField- The Header-Field (key) of which's list of values the values are to be added.aValues- The values to be added to the list of values associated to the given Header-Field (key).- Returns:
- This
HttpFieldsinstance to continue building up the Header-Fields.
-
withAddTo
default B withAddTo(Enum<?> aField, List<String> aValues)
Same aswithAddTo(String, List)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the fieldaValues- the values- Returns:
- the b
- See Also:
addTo(String, List)
-
toField
default String toField(String aKey)
This method returns a singleString(instead of returning aListofStringinstances when callingMap.get(Object)) where the elements of the filed are separated by theDelimiter.HTTP_HEADER_ELEMENTSand concatenated as a singleString.
-
toField
default String toField(Enum<?> aField)
Same astoField(String)though using the provided enumeration'sEnum.toString()method to determine the key.- Parameters:
aField- the field- Returns:
- the string
- See Also:
toField(String)
-
-