Package org.refcodes.net
Class AbstractHttpFields<T extends HttpFields<T>>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<java.lang.String,java.util.List<java.lang.String>>
-
- org.refcodes.net.AbstractHttpFields<T>
-
- Type Parameters:
T
- The type of the sub-class, required for the builder methods such asHttpFields.withAddTo(String, String)
.
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.String,java.util.List<java.lang.String>>
,HttpFields<T>
- Direct Known Subclasses:
AbstractHeaderFields
,FormFieldsImpl
public abstract class AbstractHttpFields<T extends HttpFields<T>> extends java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> implements HttpFields<T>
Abstract implementation of theHeaderFields
type.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractHttpFields()
Instantiates an empty instance.AbstractHttpFields(java.util.Map<java.lang.String,java.util.List<java.lang.String>> aHttpFields)
Initializes the instance with the fields provided by the givenMap
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static void
copyHttpFields(java.util.Map<java.lang.String,java.util.List<java.lang.String>> aFromFields, HttpFields<?> aToFields)
Copies the provided "from" fields into the provided "to" fields.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from interface org.refcodes.net.HttpFields
addTo, addTo, addTo, addTo, addTo, addTo, getFirst, getFirst, put, put, put, put, toField, toField, withAddTo, withAddTo, withAddTo, withAddTo, withAddTo, withAddTo, withPut, withPut, withPut, withPut, withPut, withPut
-
-
-
-
Constructor Detail
-
AbstractHttpFields
public AbstractHttpFields()
Instantiates an empty instance.
-
AbstractHttpFields
public AbstractHttpFields(java.util.Map<java.lang.String,java.util.List<java.lang.String>> aHttpFields)
Initializes the instance with the fields provided by the givenMap
.- Parameters:
aHttpFields
- TheMap
from which to get the keys and values for initializing this instance.
-
-
Method Detail
-
copyHttpFields
protected static void copyHttpFields(java.util.Map<java.lang.String,java.util.List<java.lang.String>> aFromFields, HttpFields<?> aToFields)
Copies the provided "from" fields into the provided "to" fields. Omits empty or null values.- Parameters:
aFromFields
- The fields from which to copy.aToFields
- The fields to which to copy.
-
-