Record Class MessageKey
java.lang.Object
java.lang.Record
com.ultikits.ultitools.text.MessageKey
- Record Components:
namespace- the catalogue namespacepath- the catalogue entry path
A stable message key of the form
namespace:path, such as
ultiessentials:home.set.success. The namespace identifies a module's
catalogue and is derived from its plugin.yml name with namespaceFor(String).
The path consists of lowercase, dot-separated [a-z0-9_-] segments.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageKey(String namespace, String path) Validates both parts, each at most 128 characters. -
Method Summary
Modifier and TypeMethodDescriptionnet.kyori.adventure.key.KeyasKey()Returns this key as an Adventure key; always valid by construction.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thenamespacerecord component.static StringnamespaceFor(String moduleName) static MessageKeyReturns a validated key, equivalent to the canonical constructor.static MessageKeyParsesnamespace:path.path()Returns the value of thepathrecord component.toString()ReturnstranslationKey().Returnsnamespace + ":" + path, the Adventure translation key.
-
Field Details
-
namespace
-
path
-
FRAMEWORK_NAMESPACE
-
NAMESPACE
-
PATH
-
-
Constructor Details
-
MessageKey
Validates both parts, each at most 128 characters.- Throws:
IllegalArgumentException- if a part is invalid or the namespace is..
-
-
Method Details
-
of
Returns a validated key, equivalent to the canonical constructor. -
parse
Parsesnamespace:path.- Throws:
IllegalArgumentException- unless exactly one colon separates two valid parts
-
namespaceFor
Lowercases a module name withLocale.ROOT, replacing every character outside[a-z0-9_.-]with_. Uniqueness is checked at module load.- Throws:
IllegalArgumentException- if the result is empty,.., or longer than 128 characters
-
translationKey
Returnsnamespace + ":" + path, the Adventure translation key. -
asKey
public net.kyori.adventure.key.Key asKey()Returns this key as an Adventure key; always valid by construction. -
toString
-
hashCode
-
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
-
path
-