Package wtf.choco.veinminer.util
Record Class NamespacedKey
java.lang.Object
java.lang.Record
wtf.choco.veinminer.util.NamespacedKey
- Record Components:
namespace
- the namespacekey
- the key
Represents a unique key with a namespace. Keys are under the format
namespace:key
.-
Constructor Summary
ConstructorDescriptionNamespacedKey
(@NotNull String namespace, @NotNull String key) Creates an instance of aNamespacedKey
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.static @NotNull NamespacedKey
fromString
(@NotNull String input) Get aNamespacedKey
from an input string.static @NotNull NamespacedKey
fromString
(@NotNull String input, @NotNull String defaultNamespace) Get aNamespacedKey
from an input string.final int
hashCode()
Returns a hash code value for this object.@NotNull String
key()
Returns the value of thekey
record component.static @NotNull NamespacedKey
Get aNamespacedKey
under theminecraft
namespace.@NotNull String
Returns the value of thenamespace
record component.toString()
Returns a string representation of this record class.static @NotNull NamespacedKey
Get aNamespacedKey
under theveinminer
namespace.
-
Constructor Details
-
Method Details
-
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. -
minecraft
Get aNamespacedKey
under theminecraft
namespace.- Parameters:
key
- the key- Returns:
- the Minecraft namespaced key
-
veinminer
Get aNamespacedKey
under theveinminer
namespace.- Parameters:
key
- the key- Returns:
- the VeinMiner namespaced key
-
fromString
@NotNull public static @NotNull NamespacedKey fromString(@NotNull @NotNull String input, @NotNull @NotNull String defaultNamespace) Get aNamespacedKey
from an input string. If the input does not have a valid namespace, the provided namespace will be used in conjunction with the rest of the key.- Parameters:
input
- the input stringdefaultNamespace
- the namespace to use if none is present in the input string- Returns:
- the resulting key
-
fromString
Get aNamespacedKey
from an input string. If the input does not have a valid namespace, the Minecraft namespace will be used in conjunction with the rest of the key.- Parameters:
input
- the input string- Returns:
- the resulting key
-
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. -
equals
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 withObjects::equals(Object,Object)
. -
namespace
Returns the value of thenamespace
record component.- Returns:
- the value of the
namespace
record component
-
key
Returns the value of thekey
record component.- Returns:
- the value of the
key
record component
-