Class MacroKey
java.lang.Object
com.winterhavenmc.library.messagebuilder.keys.AbstractKey
com.winterhavenmc.library.messagebuilder.keys.MacroKey
- All Implemented Interfaces:
StandardKey
A type that represents a validated key for a macro. This type guarantees a valid key that has been
validated upon creation. The static factory methods return an Optional of the RecordKey,
or an empty Optional if the parameter was invalid, as determined by regex pattern and Predicate.
-
Field Summary
Fields inherited from class com.winterhavenmc.library.messagebuilder.keys.AbstractKey
IS_INVALID_KEY, VALID_KEY, wrappedString
-
Method Summary
Modifier and TypeMethodDescriptionappend
(E subKey) Create a new key by suffixing a dot-separated subkey to this existing keyCreate a new key by suffixing a dot-separated subkey to this existing keygetBase()
of
(E key) Static factory method for instantiating a record key from an enum constantStatic factory method for instantiating a record key from a stringMethods inherited from class com.winterhavenmc.library.messagebuilder.keys.AbstractKey
equals, hashCode, toString
-
Method Details
-
of
Static factory method for instantiating a record key from a string- Parameters:
key
- a String to be used in the creation of a record key- Returns:
- an Optional RecordKey, or an empty Optional if the key parameter is null or invalid
-
of
Static factory method for instantiating a record key from an enum constant- Type Parameters:
E
- an enum constant- Parameters:
key
- an enum constant whose name is used to create a record key- Returns:
- an Optional RecordKey, or an empty Optional if the key parameter is null or invalid
-
append
Create a new key by suffixing a dot-separated subkey to this existing key- Type Parameters:
E
- an enum constant- Parameters:
subKey
- an enu constant whose name() is to be used for the appended subkey- Returns:
- a new key with the subkey appended, or an empty Optional if the string was not a valid key
-
append
Create a new key by suffixing a dot-separated subkey to this existing key- Parameters:
subKey
- a string to be used for the appended subkey- Returns:
- a new key with the subkey appended, or an empty Optional if the string was not a valid key
-
getBase
-
asPlaceholder
-