public class FormaterImpl extends Object implements Formater
Constructor and Description |
---|
FormaterImpl()
构造函数 使用默认的配置加载器
|
Modifier and Type | Method and Description |
---|---|
void |
addFormatProvider(String prefix,
FormatProvider formatProvider)
添加格式化提供者
|
String |
format(Context context,
String source)
格式化找到的内容,其余内容不变,如果找不到内容,则原样保留
|
void |
setFormatProviders(Map<String,FormatProvider> formatProviders)
设置格式化提供者
|
void |
setPatternHandle(PatternDefine patternHandle)
设置正则表达式,如果不想用默认正则表达式,可以通过此方法自行定义
|
public String format(Context context, String source) throws FormatException
format
in interface FormatProvider
source
- 要进行格式化的值FormatException
public void setFormatProviders(Map<String,FormatProvider> formatProviders)
Formater
setFormatProviders
in interface Formater
formatProviders
- Key为匹配范围符public void setPatternHandle(PatternDefine patternHandle)
Formater
setPatternHandle
in interface Formater
public void addFormatProvider(String prefix, FormatProvider formatProvider)
Formater
addFormatProvider
in interface Formater
prefix
- 前缀Copyright © 2006–2018 TinyGroup. All rights reserved.