Package valorless.valorlessutils.json
Interface MessageArguments
public interface MessageArguments
Provides message arguments by key.
-
Method Summary
Modifier and TypeMethodDescriptiondefault MessageArgumentscombinedWith(MessageArguments other) Creates aMessageArgumentsthat combines this and the given otherMessageArguments.@Nullable ObjectGets the message argument for the specified key.static MessageArgumentsCreates aMessageArgumentsthat is backed by the givenMap.default MessageArgumentsCreates aMessageArgumentsthat prefixes the keys of thisMessageArguments.
-
Method Details
-
ofMap
Creates aMessageArgumentsthat is backed by the givenMap.The returned
MessageArgumentsis a view on the underlying Map: It dynamically reflects changes to the underlying Map.- Parameters:
arguments- the mapping from keys to message arguments, notnull- Returns:
- the
MessageArguments
-
get
Gets the message argument for the specified key.The returned message argument can be of any type. The caller of this method is responsible for formatting it appropriately for use as message argument. The returned object may also be a
Supplier: In this case, the object returned by the Supplier is meant to be used as the actual message argument.- Parameters:
key- the key- Returns:
- the message argument, or
nullif there is none for the given key
-
combinedWith
Creates aMessageArgumentsthat combines this and the given otherMessageArguments.If no argument is found for a key inside this
MessageArguments, the given otherMessageArgumentsis queried for an argument.- Parameters:
other- the otherMessageArguments- Returns:
- the combined
MessageArguments
-
prefixed
Creates aMessageArgumentsthat prefixes the keys of thisMessageArguments.The returned
MessageArgumentsis a view: The prefix is dynamically stripped from the passed keys in order to construct the key with which the lookup is performed in this originalMessageArguments.- Parameters:
keyPrefix- the key prefix, notnull- Returns:
- the prefixed
MessageArguments
-