public class SimpleDictionaryParser<V> extends Object implements DictionaryParser<V>
e.g.
//字典
[
{text:"苹果",value:1,
children:[
{text:"青苹果",value:101},
{text:"红富士",value:102},
{text:"其他苹果",value:103,textExpression:"其他苹果(${#context.otherApple})"}
]}
{text:"梨子",value:2}
]
//调用
parser.valueToText("1,101,103",{otherApple:"其他苹果1"});
//返回结果 苹果(青苹果,其他苹果(其他苹果1))
//调用
parser.textToValue("苹果(青苹果,其他苹果)")
//返回结果 1,101,103
| 构造器和说明 |
|---|
SimpleDictionaryParser() |
| 限定符和类型 | 方法和说明 |
|---|---|
SimpleDictionaryParser<V> |
addToTextExpression(String id,
String expression) |
SimpleDictionaryParser<V> |
addToValueExpression(String id,
String expression) |
SingleDictParser |
getToTextParser() |
SingleDictParser |
getToValueParser() |
SimpleDictionaryParser<V> |
setDict(DictionaryEntity dict) |
void |
setToTextExpressions(Map<String,String> toTextExpressions) |
void |
setToTextParser(SingleDictParser toTextParser) |
void |
setToValueExpressions(Map<String,String> toValueExpressions) |
void |
setToValueParser(SingleDictParser toValueParser) |
Optional<V> |
textToValue(String text,
Object context) |
Optional<String> |
valueToText(V value,
Object context) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittextToValue, valueToTextpublic SimpleDictionaryParser<V> addToTextExpression(String id, String expression)
public SimpleDictionaryParser<V> addToValueExpression(String id, String expression)
public SingleDictParser getToTextParser()
public SingleDictParser getToValueParser()
public void setToTextParser(SingleDictParser toTextParser)
public void setToValueParser(SingleDictParser toValueParser)
public SimpleDictionaryParser<V> setDict(DictionaryEntity dict)
public Optional<String> valueToText(V value, Object context)
valueToText 在接口中 DictionaryParser<V>public Optional<V> textToValue(String text, Object context)
textToValue 在接口中 DictionaryParser<V>Copyright © 2016–2019. All rights reserved.