Class PreviewTokenValidated

java.lang.Object
com.broadleafcommerce.sandbox.web.endpoint.PreviewTokenValidated

public final class PreviewTokenValidated extends Object
The details provided when a preview token is validated.

If found valid, the valid(PreviewToken, Set) static constructor should be used to provide the response.

If found invalid, the PreviewTokenValidated#invalid() static constructor should be used to provide the response.

Author:
Nick Crum (ncrum)
  • Method Details

    • valid

      public static PreviewTokenValidated valid(@NonNull com.broadleafcommerce.data.tracking.core.preview.PreviewToken content, @NonNull Set<Sandbox> sandboxes)
      Static constructor used for instantiating a valid response.
      Parameters:
      content - the decoded preview token
      sandboxes - the set of sandboxes supported
      Returns:
      the valid response object
    • invalid

      public static PreviewTokenValidated invalid(String reason)
      Static constructor used for instantiating an invalid response.
      Returns:
      the invalid response object
    • isValid

      public boolean isValid()
      Whether or not the token provided is valid.
      Returns:
      whether or not the token is valid
    • getContent

      @Nullable public com.broadleafcommerce.data.tracking.core.preview.PreviewToken getContent()
      If valid, this will include the content of the decoded preview token.

      If not valid, this will be null.

      Returns:
      the content of the decoded preview token
    • getSandboxes

      @Nullable public Set<Sandbox> getSandboxes()
      If valid, this will include the set of Sandbox available for preview. This sandbox information may be used for display purposes in the client.

      If not valid, this will be empty.

      Returns:
      the set of sandboxes this preview token supports
    • getReason

      public String getReason()
      If invalid, this will include the reason for why the token was found not to be valid.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object