Class CookieMap<P>

java.lang.Object
org.apache.commons.chain.web.ParameterMap<P,Cookie>
org.apache.commons.chain.web.jakarta.internal.CookieMap<P>
Type Parameters:
P - the type of the parameter-provider
All Implemented Interfaces:
Map<String,Cookie>

public class CookieMap<P> extends ParameterMap<P,Cookie>
Implementation of Map for cookies with a parameter-provider.
Since:
Chain 1.3
Author:
Graff Stefan
  • Constructor Details

    • CookieMap

      public CookieMap(P request, Supplier<Cookie[]> cookiesSupplier)
      The constructor for the Map for cookies.
      Parameters:
      request - the request with the cookies
      cookiesSupplier - Supplier to return the Cookie-Array in this object
  • Method Details

    • containsKey

      public boolean containsKey(Object key)
      Returns true if this cookie-map contains a mapping for the specified cookie-name.
      Specified by:
      containsKey in interface Map<String,Cookie>
      Overrides:
      containsKey in class ParameterMap<P,Cookie>
      Parameters:
      key - The key whose presence in this cookie-map is to be tested
      Returns:
      true if this cookie-map contains a mapping for the specified cookie-name.
    • containsValue

      public boolean containsValue(Object value)
      Returns true if this cookie-map maps one or more keys to the specified cookie.
      Specified by:
      containsValue in interface Map<String,Cookie>
      Overrides:
      containsValue in class ParameterMap<P,Cookie>
      Parameters:
      value - cookie whose presence in this cookie-map is to be tested
      Returns:
      true if this cookie-map maps one or more keys to the specified cookie
    • entrySet

      Returns a Set view of the mappings contained in this cookie-map. The set is not backed by the cookie-map, so changes to the cookie-map are not reflected in the set, and vice-versa.
      Specified by:
      entrySet in interface Map<String,Cookie>
      Overrides:
      entrySet in class ParameterMap<P,Cookie>
      Returns:
      a set view of the mappings contained in this cookie-map
    • get

      public Cookie get(Object key)
      Returns the cookie to which the specified cookie-name is mapped, or null if this cookie-map contains no mapping for the cookie-name.
      Specified by:
      get in interface Map<String,Cookie>
      Overrides:
      get in class ParameterMap<P,Cookie>
      Parameters:
      key - the cookie-name whose associated value is to be returned
      Returns:
      the value to which the specified key is mapped, or null if this cookie-map contains no mapping for the cookie-name
      See Also:
    • isEmpty

      public boolean isEmpty()
      Returns true if this cookie-map contains no cookies.
      Specified by:
      isEmpty in interface Map<String,Cookie>
      Overrides:
      isEmpty in class ParameterMap<P,Cookie>
      Returns:
      true if this cookie-map contains no cookies
    • keySet

      public Set<String> keySet()
      Returns a Set view of the cookies contained in this cookie-map. The set is not backed by the cookie-map, so changes to the cookie-map are not reflected in the set, and vice-versa.
      Specified by:
      keySet in interface Map<String,Cookie>
      Overrides:
      keySet in class ParameterMap<P,Cookie>
      Returns:
      a set view of the cookies contained in this cookie-map
    • size

      public int size()
      Returns the number of cookies in this cookie-map.
      Specified by:
      size in interface Map<String,Cookie>
      Overrides:
      size in class ParameterMap<P,Cookie>
      Returns:
      the number of cookies in this cookie-map
    • values

      Returns a Collection view of the cookies contained in this cookie-map. The collection is not backed by the cookie-map, so changes to the cookie-map are not reflected in the collection, and vice-versa.
      Specified by:
      values in interface Map<String,Cookie>
      Overrides:
      values in class ParameterMap<P,Cookie>
      Returns:
      a view of the cookies contained in this cookie-map
    • hashCode

      public int hashCode()
      Returns the hash code value for this cookie-map. The hash code of a cookie-map is defined to be the sum of the hash codes of each entry in the cookie-map's entrySet() view. This ensures that m1.equals(m2) implies that m1.hashCode()==m2.hashCode() for any two parameter-maps m1 and m2, as required by the general contract of Object.hashCode().
      Specified by:
      hashCode in interface Map<String,Cookie>
      Overrides:
      hashCode in class ParameterMap<P,Cookie>
      Returns:
      the hash code value for this cookie-map
      Implementation Requirements:
      This implementation calls the hashCode() from the parameter-map.
    • equals

      public boolean equals(Object obj)
      Compares the specified object with this cookie-map for equality. Returns true if the given object is also a cookie-map and the two cookie-maps represent the same mappings. More formally, two cookie-maps m1 and m2 represent the same mappings if m1.entrySet().equals(m2.entrySet()).
      Specified by:
      equals in interface Map<String,Cookie>
      Overrides:
      equals in class ParameterMap<P,Cookie>
      Parameters:
      obj - object to be compared for equality with this cookie-map
      Returns:
      true if the specified object is equal to this cookie-map