Package cloud.commandframework.keys
Class SimpleCloudKey<T>
- java.lang.Object
-
- cloud.commandframework.keys.SimpleCloudKey<T>
-
- Type Parameters:
T- Key type
- All Implemented Interfaces:
CloudKey<T>
public final class SimpleCloudKey<@NonNull T> extends java.lang.Object implements CloudKey<T>
Simple immutable implementation ofCloudKey. 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)@NonNull java.lang.StringgetName()Get the name of the key.@NonNull io.leangen.geantyref.TypeToken<T>getType()Get the type of the value that this key holds.inthashCode()static @NonNull CloudKey<java.lang.Void>of(@NonNull java.lang.String name)Create a new type-less simple cloud keystatic <@NonNull T>
CloudKey<T>of(@NonNull java.lang.String name, @NonNull io.leangen.geantyref.TypeToken<@NonNull T> type)Create a new simple cloud keyjava.lang.StringtoString()
-
-
-
Method Detail
-
of
public static <@NonNull T> CloudKey<T> of(@NonNull java.lang.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 keytype- The type of the value represented by the key- Returns:
- The created key instance
-
of
public static @NonNull CloudKey<java.lang.Void> of(@NonNull java.lang.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 java.lang.String getName()
Description copied from interface:CloudKeyGet 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.
-
getType
public @NonNull io.leangen.geantyref.TypeToken<T> getType()
Description copied from interface:CloudKeyGet the type of the value that this key holds.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-