Interface Context
@NonExtendable
public interface Context
Parser context for use within transformations.
This allows operating recursive parses, for cases where messages may include parse-specific tags.
- Since:
- 4.10.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull Component
deserialize
(@NotNull String message) Deserializes a MiniMessage string using all the settings of this context.@NotNull Component
deserialize
(@NotNull String message, @NotNull TagResolver resolver) Deserializes a MiniMessage string using all the settings of this context.@NotNull Component
deserialize
(@NotNull String message, @NotNull TagResolver @NotNull ... resolvers) Deserializes a MiniMessage string using all the settings of this context.@NotNull ParsingException
newException
(@NotNull String message) Create a new parsing exception without reference to a specific location.@NotNull ParsingException
newException
(@NotNull String message, @NotNull ArgumentQueue tags) Create a new parsing exception.@NotNull ParsingException
newException
(@NotNull String message, @Nullable Throwable cause, @NotNull ArgumentQueue args) Create a new parsing exception.@Nullable Pointered
target()
The target of the parse context, if provided.<T extends Pointered>
TtargetAsType
(@NotNull Class<T> targetClass) The target of the parse context, casted to a provided type.@NotNull Pointered
The target of the parse context.
-
Method Details
-
target
The target of the parse context, if provided. Can be used for tags that provide information relating to the target of the resulting message.- Returns:
- the target, if provided
- Since:
- 4.17.0
-
targetOrThrow
The target of the parse context. Can be used for tags that provide information relating to the target of the resulting message.If the caller did not provide a target, a parse exception is thrown with a default message.
- Returns:
- the target, if provided
- Since:
- 4.17.0
-
targetAsType
The target of the parse context, casted to a provided type. Can be used for tags that provide information relating to the target of the resulting message.If the caller did not provide a target, or the target is not of the provided type, a parse exception is thrown with a default message.
- Type Parameters:
T
- the required type- Parameters:
targetClass
- the class of the required type- Returns:
- the target
- Since:
- 4.17.0
-
deserialize
Deserializes a MiniMessage string using all the settings of this context.- Parameters:
message
- the message to parse- Returns:
- the parsed message
- Since:
- 4.10.0
-
deserialize
@NotNull @NotNull Component deserialize(@NotNull @NotNull String message, @NotNull @NotNull TagResolver resolver) Deserializes a MiniMessage string using all the settings of this context.- Parameters:
message
- the message to parseresolver
- additional tag resolver, added to all other resolvers in this parse, but taking priority in the event of a name overlap- Returns:
- the parsed message
- Since:
- 4.10.0
-
deserialize
@NotNull @NotNull Component deserialize(@NotNull @NotNull String message, @NotNull @NotNull TagResolver @NotNull ... resolvers) Deserializes a MiniMessage string using all the settings of this context.- Parameters:
message
- the message to parseresolvers
- additional tag resolvers, added to all other resolvers in this parse, but taking priority in the event of a name overlap- Returns:
- the parsed message
- Since:
- 4.10.0
-
newException
@NotNull @NotNull ParsingException newException(@NotNull @NotNull String message, @NotNull @NotNull ArgumentQueue tags) Create a new parsing exception.- Parameters:
message
- a detail message describing the errortags
- the tag parts which caused the error- Returns:
- the new parsing exception
- Since:
- 4.10.0
-
newException
Create a new parsing exception without reference to a specific location.- Parameters:
message
- a detail message describing the error- Returns:
- the new parsing exception
- Since:
- 4.10.0
-
newException
@NotNull @NotNull ParsingException newException(@NotNull @NotNull String message, @Nullable @Nullable Throwable cause, @NotNull @NotNull ArgumentQueue args) Create a new parsing exception.- Parameters:
message
- a detail message describing the errorcause
- the causeargs
- arguments that caused the errors- Returns:
- the new parsing exception
- Since:
- 4.10.0
-