Package com.unblu.sdk.core.configuration
Class UnbluCookie
- java.lang.Object
-
- com.unblu.sdk.core.configuration.UnbluCookie
-
public class UnbluCookie extends java.lang.Object
Cookie representation for the Unblu sdkused together with the
UnbluClientConfiguration.Builder.setCustomCookies(Set)
of the configuration
-
-
Constructor Summary
Constructors Constructor Description UnbluCookie(java.lang.String key, java.lang.String value)
Constructs an UnbluCookie object from the parameters provided.UnbluCookie(java.lang.String key, java.lang.String value, java.util.Date expires)
Constructs an UnbluCookie object from the parameters providedUnbluCookie(java.net.HttpCookie cookie)
Constructs an UnbluCookie object from aHttpCookie
object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static java.util.Set<UnbluCookie>
from(java.util.List<java.net.HttpCookie> cookies)
Creates a Set<UnbluCookie> from a Set<java.net.HttpCookie>.
The constructor calculates each cookie's Expires attribute from its Max-Age attribute.static java.util.Set<UnbluCookie>
from(java.util.Map<java.lang.String,java.lang.String> cookies)
Creates a Set<UnbluCookie> from a Map<String, String>.
Cookies created with this constructor never expire.java.util.Date
getExpires()
java.lang.String
getKey()
java.lang.String
getValue()
int
hashCode()
-
-
-
Constructor Detail
-
UnbluCookie
public UnbluCookie(@NonNull java.net.HttpCookie cookie)
Constructs an UnbluCookie object from aHttpCookie
object.
The cookie's Expires attribute is calculated from its Max-Age attribute. Set Max-Age to -1 to ensure the cookie never expires.- Parameters:
cookie
- The HttpCookie object from which to construct the UnbluCookie
-
UnbluCookie
public UnbluCookie(@NonNull java.lang.String key, @NonNull java.lang.String value, @Nullable java.util.Date expires)
Constructs an UnbluCookie object from the parameters provided- Parameters:
key
- The cookie's namevalue
- The cookie's valueexpires
- The cookie's Expires attribute
-
UnbluCookie
public UnbluCookie(@NonNull java.lang.String key, @NonNull java.lang.String value)
Constructs an UnbluCookie object from the parameters provided.
Cookies created with this constructor never expire.- Parameters:
key
- The cookie's namevalue
- The cookie value
-
-
Method Detail
-
getKey
@NonNull public java.lang.String getKey()
- Returns:
- The name of the cookie
-
getValue
@Nullable public java.lang.String getValue()
- Returns:
- The value of the cookie
-
getExpires
@Nullable public java.util.Date getExpires()
- Returns:
- The value of the cookie's Expires attribute
-
from
public static java.util.Set<UnbluCookie> from(@NonNull java.util.Map<java.lang.String,java.lang.String> cookies)
Creates a Set<UnbluCookie> from a Map<String, String>.
Cookies created with this constructor never expire.- Parameters:
cookies
- The custom cookie Map<key,value>- Returns:
Set
-
from
public static java.util.Set<UnbluCookie> from(@NonNull java.util.List<java.net.HttpCookie> cookies)
Creates a Set<UnbluCookie> from a Set<java.net.HttpCookie>.
The constructor calculates each cookie's Expires attribute from its Max-Age attribute. Set Max-Age to -1 to ensure the cookie never expires.- Parameters:
cookies
- The HttpCookie List<HttpCookie>- Returns:
Set
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-