Enum Class ScriptType

java.lang.Object
java.lang.Enum<ScriptType>
org.bitcoinj.base.ScriptType
All Implemented Interfaces:
Serializable, Comparable<ScriptType>, Constable

public enum ScriptType extends Enum<ScriptType>
Supported Bitcoin script types and their script identifier strings. The script identifier string for a ScriptType is the "human-readable identifier string" of a Script Expression as defined in BIP 380. Only the subset of identifier strings defined in BIP 381 and BIP 382 map to valid ScriptType instances.
See Also:
  • Enum Constant Details

  • Field Details

  • Method Details

    • values

      public static ScriptType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ScriptType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • of

      public static ScriptType of(String id)
      Use this method to create a ScriptType from a known good script identifier string.
      Parameters:
      id - A script identifier string
      Returns:
      the script type
      Throws:
      IllegalArgumentException - if unknown/invalid script identifier string
    • find

      public static Optional<ScriptType> find(String id)
      Use this method to create a ScriptType from a script identifier string that should be validated.
      Parameters:
      id - A script identifier string
      Returns:
      A ScriptType-containing Optional or Optional.empty()
    • id

      public String id()
      Return the script identifier string for this ScriptType.

      Be careful: the id() method returns a different type and value than what is in the deprecated id field.

      Returns:
      A script identifier string
    • numericId

      @Deprecated public int numericId()
      Deprecated.
      Using id() to get a script identifier string is preferred.
      This is deprecated. But less deprecated than accessing the id field directly.
      Returns:
      A numeric ID