Record Class RFC7230Token

java.lang.Object
java.lang.Record
org.htmlunit.csp.value.RFC7230Token
Record Components:
value - the token string

public record RFC7230Token(String value) extends Record
Represents an RFC 7230 token value, used as the value of the report-to CSP directive.

An RFC 7230 token is a sequence of one or more characters from the tchar set defined in RFC 7230 §3.2.6. The value is preserved as-is (case-sensitive).

Author:
Salvation Team
See Also:
  • Constructor Details

    • RFC7230Token

      public RFC7230Token(String value)
      Creates an instance of a RFC7230Token record class.
      Parameters:
      value - the value for the value record component
  • Method Details

    • parseRFC7230Token

      public static Optional<RFC7230Token> parseRFC7230Token(String value)
      Parses an RFC 7230 token from the given string.

      The input must consist entirely of valid tchar characters as defined in RFC 7230.

      Parameters:
      value - the string to parse
      Returns:
      an Optional containing the parsed RFC7230Token, or empty if the value does not match the RFC 7230 token grammar
    • toString

      public String toString()
      Returns the token value as-is.
      Specified by:
      toString in class Record
      Returns:
      the RFC 7230 token string
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      public String value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component