Record Class Implementation<T extends Implementation.ExtensionProvidable>

java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.extension.Implementation<T>
Record Components:
type - the Class of the implemented interface
supplier - the Function used to retrieve instances of the custom implementation

Instances of Implementation are used to provide custom implementations of Implementation.ExtensionProvidable interfaces, namely:

Such instances of Implementation are returned by Extension.providedImplementations() and used by the JDACBuilder to configure jda-commands.

Note: If the supplier() returns an empty collection, then this Implementation is discarded and thus treated as non-existent.

See Also:
  • Constructor Details

  • Method Details

    • single

      public static <T extends Implementation.ExtensionProvidable> Implementation<T> single(Class<T> type, Function<JDACBuilderData, T> supplier)
    • 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.
    • type

      public Class<T> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • supplier

      Returns the value of the supplier record component.
      Returns:
      the value of the supplier record component