类 ContentHandler<RECEIVER,SELF extends ContentHandler<RECEIVER,SELF>>
java.lang.Object
cc.carm.lib.configuration.value.text.function.ContentHandler<RECEIVER,SELF>
- 所有已实现的接口:
Insertable<RECEIVER,,SELF> Replaceable<RECEIVER,SELF>
- 直接已知子类:
TextParser
public abstract class ContentHandler<RECEIVER,SELF extends ContentHandler<RECEIVER,SELF>>
extends Object
implements Replaceable<RECEIVER,SELF>, Insertable<RECEIVER,SELF>
-
字段概要
字段修饰符和类型字段说明protected booleanprotected @NotNull List<ContentInserter<RECEIVER>>Used to store the insertion of the messageprotected Stringprotected @NotNull ParamReplacer<RECEIVER>Used to store the placeholders of the messageprotected @NotNull String[]protected BiFunction<RECEIVER,String, String> protected @NotNull List<ContentReplacer<RECEIVER>> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明buildParams(@NotNull UnaryOperator<String> paramBuilder, @Nullable String[] params, @Nullable Object[] values) Disable the insertion of the text.Enable the insertion of the text.getInsertion(@NotNull String id, RECEIVER receiver) voidhandle(@NotNull TextContents contents, RECEIVER receiver, @NotNull Consumer<String> lineConsumer) Insert the specific contents by the id.inserter(@NotNull ContentInserter<RECEIVER> inserter) booleanlineSeparator(@NotNull String lineSeparator) Set the line separator for the text.booleanparamReplacer(@NotNull ParamReplacer<RECEIVER> paramReplacer) Set the params for the text, used forplaceholders(Object...)to build the placeholders.protected @Nullable StringParse the supplied single text for the receiver.parser(@NotNull BiFunction<RECEIVER, String, String> parser) Set the parser for the text.placeholder(@NotNull String key, @Nullable Object value) Set the placeholder for the text.placeholders(@NotNull Consumer<Map<String, Object>> consumer) Set the placeholders for the text.placeholders(@NotNull Map<String, Object> placeholders) Set all the placeholders for the text.placeholders(@Nullable Object... values) Set the placeholders for the text.removeInsert(@NotNull String id) replacer(@NotNull ContentReplacer<RECEIVER> replacer) abstract SELFself()static StringsetPlaceholders(@NotNull String messages, @NotNull Map<String, Object> placeholders) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cc.carm.lib.configuration.value.text.function.inserter.Insertable
insert, insert, insert从接口继承的方法 cc.carm.lib.configuration.value.text.function.replacer.Replaceable
applyReplacements, replace, replace, replace, replace, replace, replace, replace, replacer
-
字段详细资料
-
parser
-
lineSeparator
-
paramReplacer
Used to store the placeholders of the message -
params
-
replacers
-
inserters
-
insertion
Used to store the insertion of the message -
disableInsertion
protected boolean disableInsertion
-
-
构造器详细资料
-
ContentHandler
public ContentHandler()
-
-
方法详细资料
-
self
-
disableInsertion
Disable the insertion of the text.
If the insertion is disabled, the text will be parsed directly.- 返回:
- the current
ContentHandlerinstance
-
enableInsertion
Enable the insertion of the text.- 返回:
- the current
ContentHandlerinstance
-
noneInsertion
public boolean noneInsertion()- 指定者:
noneInsertion在接口中Insertable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>>
-
lineSeparator
Set the line separator for the text.- 参数:
lineSeparator- the line separator, default isSystem.lineSeparator()- 返回:
- the current
ContentHandlerinstance
-
placeholders
Set all the placeholders for the text.
Will override the previous placeholders modifications.- 参数:
placeholders- the placeholders- 返回:
- the current
ContentHandlerinstance
-
placeholders
Set the placeholders for the text.- 参数:
consumer- the placeholders- 返回:
- the current
ContentHandlerinstance
-
placeholders
Set the placeholders for the text.- 参数:
values- The values to replace theparams(String...).- 返回:
- the current
ContentHandlerinstance
-
placeholder
Set the placeholder for the text.- 参数:
key- the key of the placeholdervalue- the value of the placeholder- 返回:
- the current
ContentHandlerinstance
-
params
Set the params for the text, used forplaceholders(Object...)to build the placeholders.- 参数:
params- the params- 返回:
- the current
ContentHandlerinstance
-
replacers
- 指定者:
replacers在接口中Replaceable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>>
-
replacer
- 指定者:
replacer在接口中Replaceable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>>
-
paramReplacer
-
inserters
- 指定者:
inserters在接口中Insertable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>>
-
inserter
- 指定者:
inserter在接口中Insertable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>>
-
insert
public SELF insert(@NotNull @NotNull String id, @Nullable @Nullable Function<RECEIVER, List<String>> supplier) 从接口复制的说明:InsertableInsert the specific contents by the id.- 指定者:
insert在接口中Insertable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>> - 参数:
id- the id of the insertion textsupplier- to supply the lines to insert- 返回:
- the current
ContentHandlerinstance
-
inserting
- 指定者:
inserting在接口中Insertable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>>
-
getInsertion
@Nullable public @Nullable List<String> getInsertion(@NotNull @NotNull String id, @Nullable RECEIVER receiver) - 指定者:
getInsertion在接口中Insertable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>>
-
removeInsert
- 指定者:
removeInsert在接口中Insertable<RECEIVER,SELF extends ContentHandler<RECEIVER, SELF>>
-
parser
Set the parser for the text.- 参数:
parser- The parser- 返回:
- The current
ContentHandlerinstance
-
parse
@Nullable protected @Nullable String parse(@Nullable RECEIVER receiver, @NotNull @NotNull String text) Parse the supplied single text for the receiver.- 参数:
receiver- the receivertext- the text to parse- 返回:
- the parsed text
-
handle
public void handle(@NotNull @NotNull TextContents contents, @Nullable RECEIVER receiver, @NotNull @NotNull Consumer<String> lineConsumer) -
setPlaceholders
-
buildParams
-