Class SimpleCloudKey<T>

java.lang.Object
cloud.commandframework.keys.SimpleCloudKey<T>
Type Parameters:
T - Key type
All Implemented Interfaces:
CloudKey<T>

@API(status=STABLE, since="1.4.0") public final class SimpleCloudKey<@NonNull T> extends Object implements CloudKey<T>
Simple immutable implementation of CloudKey. Key equality is determined solely by the key name. Two keys with matching names will be equal, no matter if their type tokens are identical.
Since:
1.4.0
  • Method Details

    • of

      public static <@NonNull T> CloudKey<T> of(@NonNull String name, @NonNull io.leangen.geantyref.TypeToken<@NonNull T> type)
      Create a new simple cloud key
      Type Parameters:
      T - The generic type of the value represented by the key
      Parameters:
      name - The name of the key
      type - The type of the value represented by the key
      Returns:
      The created key instance
    • of

      public static @NonNull CloudKey<Void> of(@NonNull String name)
      Create a new type-less simple cloud key
      Parameters:
      name - The name of the key
      Returns:
      The created key instance
    • getName

      public @NonNull String getName()
      Description copied from interface: CloudKey
      Get the name of the key. The name of the key should be used to determine key equality. That means that two keys sharing the same name are equal.
      Specified by:
      getName in interface CloudKey<T>
      Returns:
      The key name
    • getType

      public @NonNull io.leangen.geantyref.TypeToken<T> getType()
      Description copied from interface: CloudKey
      Get the type of the value that this key holds.
      Specified by:
      getType in interface CloudKey<T>
      Returns:
      The type of the key value.
    • 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