BuilderChild - Builder子类TemplateChild - 模板子类protected abstract static class StrTemplate.AbstractBuilder<BuilderChild extends StrTemplate.AbstractBuilder<BuilderChild,TemplateChild>,TemplateChild extends StrTemplate> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
defaultValue
默认值
|
protected UnaryOperator<String> |
defaultValueHandler
默认值处理器
|
protected char |
escape
转义符
|
protected boolean |
escape$set
用户是否设置了 转义符
|
protected int |
features
策略值
|
protected String |
template
字符串模板
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBuilder(String template)
构造
|
| Modifier and Type | Method and Description |
|---|---|
BuilderChild |
addFeatures(StrTemplate.Feature... appendFeatures)
向 策略值 中 添加策略
同组内的策略是互斥的,一但设置为组内的某个新策略,就会清除之前的同组策略,仅保留新策略
|
TemplateChild |
build()
创建 模板对象
|
protected abstract TemplateChild |
buildInstance()
子类Builder 返回 创建的 模板对象
|
BuilderChild |
defaultValue(String defaultValue)
设置 默认值
不可能为
null,可以为 "null" |
BuilderChild |
defaultValue(UnaryOperator<String> defaultValueHandler)
设置 默认值处理器
|
BuilderChild |
escape(char escape)
设置 转义符
|
BuilderChild |
features(StrTemplate.Feature... newFeatures)
设置 新的策略值,完全覆盖旧的策略值
|
BuilderChild |
removeFeatures(StrTemplate.Feature... removeFeatures)
从 策略值 中 删除策略
删除的策略 可以 不存在
|
protected abstract BuilderChild |
self()
设置 转义符
|
protected final String template
protected String defaultValue
protected UnaryOperator<String> defaultValueHandler
protected boolean escape$set
protected char escape
protected int features
protected AbstractBuilder(String template)
template - 字符串模板public BuilderChild escape(char escape)
escape - 转义符public BuilderChild features(StrTemplate.Feature... newFeatures)
newFeatures - 新策略枚举public BuilderChild addFeatures(StrTemplate.Feature... appendFeatures)
同组内的策略是互斥的,一但设置为组内的某个新策略,就会清除之前的同组策略,仅保留新策略
appendFeatures - 需要新增的策略public BuilderChild removeFeatures(StrTemplate.Feature... removeFeatures)
删除的策略 可以 不存在
removeFeatures - 需要删除的策略public BuilderChild defaultValue(String defaultValue)
不可能为 null,可以为 "null"
defaultValue - 默认值public BuilderChild defaultValue(UnaryOperator<String> defaultValueHandler)
defaultValueHandler - 默认值处理器,根据 占位变量 返回 默认值public TemplateChild build()
protected abstract BuilderChild self()
protected abstract TemplateChild buildInstance()
Copyright © 2025. All rights reserved.