Class Placeholders<T,P extends Placeholders<T,P>>
java.lang.Object
net.dzikoysk.funnyguilds.feature.placeholders.Placeholders<T,P>
- Direct Known Subclasses:
BasicPlaceholders,GuildPlaceholders,OffsetDateTimePlaceholders,UserPlaceholders
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Pcreate()Format text with raw placeholdersformatCustom(String text, T data, String prefix, String suffix, Function<String, String> nameModifier) Format text with custom format placeholdersformatVariables(String text, T data) Format text with variable format placeholders (e.g.panda.std.Option<Placeholder<T>>getPlaceholder(String name) <M> Pmap(Placeholders<M, ?> toMap, Function<String, String> nameMapper, BiFunction<T, Placeholder<M>, Object> dataMapper) <M> Pmap(Placeholders<M, ?> toMap, Supplier<M> dataSupplier) <M> Pproperty(String name, Placeholder<T> placeholder) property(String name, MonoResolver<T> resolver) property(String name, SimpleResolver resolver) property(Map<String, Placeholder<T>> placeholders) toFormatter(T data) toVariablesFormatter(T data)
-
Field Details
-
placeholders
-
-
Constructor Details
-
Placeholders
public Placeholders()
-
-
Method Details
-
create
-
getPlaceholders
-
getPlaceholder
-
property
-
property
-
property
-
property
-
property
-
map
public <M> P map(Placeholders<M, ?> toMap, Function<String, String> nameMapper, BiFunction<T, Placeholder<M>, Object> dataMapper) -
map
-
map
-
format
Format text with raw placeholders- Parameters:
text- text to formatdata- data to use to formatting- Returns:
- formatted text
-
toFormatter
-
formatVariables
Format text with variable format placeholders (e.g. {NAME})- Parameters:
text- text to formatdata- data to use to formatting- Returns:
- formatted text
-
toVariablesFormatter
-
formatCustom
public String formatCustom(String text, T data, String prefix, String suffix, Function<String, String> nameModifier) Format text with custom format placeholders- Parameters:
text- text to formatdata- data to use to formattingprefix- prefix to use before placeholders (for eg. "{")suffix- suffix to use after placeholders (for eg. "}")nameModifier- function to modify placeholder name (for eg. upper case)- Returns:
- formatted text
-
toCustomFormatter
-