Record Class TryParser.Success<R extends @NonNull Object,T extends @NonNull Object>

java.lang.Object
java.lang.Record
dev.sympho.modular_commands.utils.parse.TryParser.Success<R,T>
Type Parameters:
R - The raw type.
T - The parsed type.
Record Components:
raw - The raw value.
item - The parsed item.
All Implemented Interfaces:
TryParser.Result<R,T>
Enclosing interface:
TryParser<R extends @NonNull Object,T extends @NonNull Object>

public static record TryParser.Success<R extends @NonNull Object,T extends @NonNull Object>(R extends @NonNull Object raw, T extends @NonNull Object item) extends Record implements TryParser.Result<R,T>
A result in which the item was parsed successfully.
Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Success(R raw, T item)
    Creates an instance of a Success record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    The error encountered in parsing, if any.
    final int
    Returns a hash code value for this object.
    Returns the value of the item record component.
    raw()
    Returns the value of the raw record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Success

      public Success(R raw, T item)
      Creates an instance of a Success record class.
      Parameters:
      raw - the value for the raw record component
      item - the value for the item record component
  • Method Details

    • error

      Description copied from interface: TryParser.Result
      The error encountered in parsing, if any.
      Specified by:
      error in interface TryParser.Result<R extends @NonNull Object,T extends @NonNull Object>
      Returns:
      The error, or null if the item was parsed successfully.
      Implementation Requirements:
      Always returns null.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
    • raw

      public R raw()
      Returns the value of the raw record component.
      Specified by:
      raw in interface TryParser.Result<R extends @NonNull Object,T extends @NonNull Object>
      Returns:
      the value of the raw record component
    • item

      public T item()
      Returns the value of the item record component.
      Specified by:
      item in interface TryParser.Result<R extends @NonNull Object,T extends @NonNull Object>
      Returns:
      the value of the item record component