本文整理了Java中org.nutz.lang.Lang.filter()
方法的一些代码示例,展示了Lang.filter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lang.filter()
方法的具体详情如下:
包路径:org.nutz.lang.Lang
类名称:Lang
方法名:filter
[英]map对象浅过滤,返回值是一个新的map
[中]地图对象浅过滤,返回值是一个新的地图
代码示例来源:origin: nutzam/nutz
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T makeDeep(Class<T> klass, String prefix) {
Map map = this;
return (T) Mapl.maplistToObj(Lang.filter(map, prefix, null, null, null), klass);
}
代码示例来源:origin: nutzam/nutz
@SuppressWarnings({ "rawtypes", "unchecked" })
public <T> T make(Class<T> klass, String prefix) {
Map map = this;
Mirror<T> mirror = Mirror.me(klass);
T t = mirror.born();
map = Lang.filter(map, prefix, null, null, null);
for (Entry<String, Object> en : ((Map<String, Object>) map).entrySet()) {
String name = en.getKey();
Injecting setter = null;
try {
setter = mirror.getInjecting(name);
}
catch (Exception e) {
log.debugf("no such field(name=%s) at object class=%s, skip", name, t.getClass().getName());
continue;
}
setter.inject(t, en.getValue());
}
return t;
}
}
代码示例来源:origin: org.nutz/nutzboot-starter-jdbc
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Map<String, String> getInitParameters() {
Map<String, String> params = new HashMap<>();
Map<String, Object> _tmp = Lang.filter((Map)conf.toMap(), PRE, null, null, null);
for (Entry<String, Object> en : _tmp.entrySet()) {
params.put(en.getKey(), String.valueOf(en.getValue()));
}
return params;
}
public int getOrder() {
代码示例来源:origin: nutzam/nutzboot
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Map<String, String> getInitParameters() {
Map<String, String> params = new HashMap<>();
Map<String, Object> _tmp = Lang.filter((Map)conf.toMap(), PRE, null, null, null);
for (Entry<String, Object> en : _tmp.entrySet()) {
params.put(en.getKey(), String.valueOf(en.getValue()));
}
return params;
}
public int getOrder() {
代码示例来源:origin: org.nutz/nutz
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T makeDeep(Class<T> klass, String prefix) {
Map map = this;
return (T) Mapl.maplistToObj(Lang.filter(map, prefix, null, null, null), klass);
}
代码示例来源:origin: nutzam/nutzboot
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Map<String, String> getInitParameters() {
Map<String, String> params = new HashMap<>();
Map<String, Object> _tmp = Lang.filter((Map)conf.toMap(), PRE, null, null, null);
if (!_tmp.containsKey(StatViewServlet.PARAM_NAME_USERNAME))
_tmp.put(StatViewServlet.PARAM_NAME_USERNAME, "druid");
if (!_tmp.containsKey(StatViewServlet.PARAM_NAME_PASSWORD)) {
String pwd = R.UU32();
_tmp.put(StatViewServlet.PARAM_NAME_PASSWORD, pwd);
log.infof("druid stat view random user=%s password=%s", _tmp.get(StatViewServlet.PARAM_NAME_USERNAME), pwd);
}
for (Entry<String, Object> en : _tmp.entrySet()) {
params.put(en.getKey(), String.valueOf(en.getValue()));
}
return params;
}
代码示例来源:origin: org.nutz/nutzboot-starter-jdbc
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Map<String, String> getInitParameters() {
Map<String, String> params = new HashMap<>();
Map<String, Object> _tmp = Lang.filter((Map)conf.toMap(), PRE, null, null, null);
if (!_tmp.containsKey(StatViewServlet.PARAM_NAME_USERNAME))
_tmp.put(StatViewServlet.PARAM_NAME_USERNAME, "druid");
if (!_tmp.containsKey(StatViewServlet.PARAM_NAME_PASSWORD)) {
String pwd = R.UU32();
_tmp.put(StatViewServlet.PARAM_NAME_PASSWORD, pwd);
log.infof("druid stat view random user=%s password=%s", _tmp.get(StatViewServlet.PARAM_NAME_USERNAME), pwd);
}
for (Entry<String, Object> en : _tmp.entrySet()) {
params.put(en.getKey(), String.valueOf(en.getValue()));
}
return params;
}
代码示例来源:origin: nutzam/nutzboot
@SuppressWarnings({"rawtypes", "unchecked"})
public static DataSource createDruidDataSource(PropertiesProxy conf, String prefix) throws Exception {
Map map = Lang.filter(new HashMap(conf.toMap()), prefix, null, null, null);
DruidDataSource dataSource = (DruidDataSource) DruidDataSourceFactory.createDataSource(map);
if (!conf.has(prefix + "filters"))
dataSource.setFilters("stat");
return dataSource;
}
代码示例来源:origin: org.nutz/nutz
@SuppressWarnings({ "rawtypes", "unchecked" })
public <T> T make(Class<T> klass, String prefix) {
Map map = this;
Mirror<T> mirror = Mirror.me(klass);
T t = mirror.born();
map = Lang.filter(map, prefix, null, null, null);
for (Entry<String, Object> en : ((Map<String, Object>) map).entrySet()) {
String name = en.getKey();
Injecting setter = null;
try {
setter = mirror.getInjecting(name);
}
catch (Exception e) {
log.debugf("no such field(name=%s) at object class=%s, skip", name, t.getClass().getName());
continue;
}
setter.inject(t, en.getValue());
}
return t;
}
}
代码示例来源:origin: org.nutz/nutzboot-starter-jdbc
@SuppressWarnings({"rawtypes", "unchecked"})
public static DataSource createDruidDataSource(PropertiesProxy conf, String prefix) throws Exception {
Map map = Lang.filter(new HashMap(conf.toMap()), prefix, null, null, null);
DruidDataSource dataSource = (DruidDataSource) DruidDataSourceFactory.createDataSource(map);
if (!conf.has(prefix + "filters"))
dataSource.setFilters("stat");
return dataSource;
}
内容来源于网络,如有侵权,请联系作者删除!