public class MapValueProvider extends Object implements ValueProvider<String>
Constructor and Description |
---|
MapValueProvider(Map<?,?> map,
boolean ignoreCase)
构造
|
MapValueProvider(Map<?,?> map,
boolean ignoreCase,
boolean ignoreError)
构造
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
是否包含指定KEY,如果不包含则忽略注入
此接口方法单独需要实现的意义在于:有些值提供者(比如Map)key是存在的,但是value为null,此时如果需要注入这个null,需要根据此方法判断 |
Object |
value(String key,
Type valueType)
获取值
返回值一般需要匹配被注入类型,如果不匹配会调用默认转换 Convert#convert(Type, Object)实现转换 |
public MapValueProvider(Map<?,?> map, boolean ignoreCase)
map
- MapignoreCase
- 是否忽略key的大小写public MapValueProvider(Map<?,?> map, boolean ignoreCase, boolean ignoreError)
map
- MapignoreCase
- 是否忽略key的大小写ignoreError
- 是否忽略错误public Object value(String key, Type valueType)
ValueProvider
value
in interface ValueProvider<String>
key
- Bean对象中参数名valueType
- 被注入的值的类型public boolean containsKey(String key)
ValueProvider
containsKey
in interface ValueProvider<String>
key
- Bean对象中参数名Copyright © 2021. All rights reserved.