Package com.stripe
Class StripeContext
java.lang.Object
com.stripe.StripeContext
The StripeContext class provides an immutable container for interacting with the `Stripe-Context`
header.
You can use it whenever you're initializing a `StripeClient` or sending `stripe_context` with a request. It's also found in the `EventNotification.context` property.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new StripeContext with no segments.StripeContext
(List<String> segments) Creates a new StripeContext with the specified segments. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns an unmodifiable list of the current segments.int
hashCode()
static StripeContext
Parse a context string into a StripeContext instance.pop()
Returns a new StripeContext with the last segment removed.Returns a new StripeContext with the given segment added to the end.toString()
Converts the context to a string by joining segments with '/'.
-
Constructor Details
-
StripeContext
public StripeContext()Creates a new StripeContext with no segments. -
StripeContext
Creates a new StripeContext with the specified segments.- Parameters:
segments
- the list of context segments
-
-
Method Details
-
push
Returns a new StripeContext with the given segment added to the end.- Parameters:
segment
- the segment to add- Returns:
- a new StripeContext instance with the segment appended
-
pop
Returns a new StripeContext with the last segment removed.- Returns:
- a new StripeContext instance with the last segment removed
-
toString
Converts the context to a string by joining segments with '/'. -
parse
Parse a context string into a StripeContext instance.- Parameters:
contextStr
- string to parse (segments separated by '/')- Returns:
- StripeContext instance with segments from the string
-
getSegments
Returns an unmodifiable list of the current segments.- Returns:
- the list of segments
-
equals
-
hashCode
public int hashCode()
-