本文整理汇总了Java中org.osgl.util.C.newMap方法的典型用法代码示例。如果您正苦于以下问题:Java C.newMap方法的具体用法?Java C.newMap怎么用?Java C.newMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgl.util.C
的用法示例。
在下文中一共展示了C.newMap方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initService
import org.osgl.util.C; //导入方法依赖的package包/类
private void initService(String ssId, Map<String, String> conf) {
Map<String, String> svcConf = C.newMap();
String prefix = "ss." + (S.empty(ssId) ? "" : ssId + ".");
for (String key : conf.keySet()) {
if (key.startsWith(prefix)) {
String o = conf.get(key);
svcConf.put(key.substring(prefix.length()), o);
}
}
String impl = svcConf.remove("impl");
String svcId = S.empty(ssId) ? DEFAULT : ssId;
if (null == impl) {
throw new ConfigurationException("Cannot init storage service[%s]: implementation not specified", svcId);
}
StoragePlugin plugin = StoragePluginManager.instance().plugin(impl);
if (null == plugin) {
throw new ConfigurationException("Cannot init storage service[%s]: implementation not found", svcId);
}
svcConf.put(IStorageService.CONF_ID, "".equals(ssId) ? DEFAULT : ssId);
IStorageService svc = plugin.initStorageService(ssId, app(), svcConf);
serviceById.put(svcId, svc);
logger.info("storage service[%s] initialized", svcId);
}
示例2: prepareJsonData
import org.osgl.util.C; //导入方法依赖的package包/类
protected Map<String, Object> prepareJsonData(List<$.T2<String, Object>> params) {
Map<String, Object> map = C.newMap();
if (null != params) {
for ($.T2<String, Object> pair : params) {
String key = pair._1;
Object val = pair._2;
if (map.containsKey(key)) {
List list;
Object x = map.get(key);
if (x instanceof List) {
list = $.cast(x);
} else {
list = C.newList(x);
map.put(key, list);
}
list.add(val);
} else {
map.put(key, val);
}
}
}
return map;
}
示例3: calibrate
import org.osgl.util.C; //导入方法依赖的package包/类
protected static Map<String, String> calibrate(Map<String, String> conf, String prefix) {
Map<String, String> map = C.newMap();
for (String key : conf.keySet()) {
String val = conf.get(key);
if (!key.startsWith("storage")) {
key = prefix + key;
}
map.put(key, val);
}
return map;
}
示例4: validate
import org.osgl.util.C; //导入方法依赖的package包/类
private void validate(Genie genie) {
Map<Object, Binder> map = C.newMap();
for (Binder<?> binder : binders) {
Object spec = binder.beanSpec(genie);
if (map.containsKey(spec)) {
throw E.invalidConfiguration("Duplicate bean spec found: ", spec);
}
map.put(spec, binder);
}
}
示例5: randomScores
import org.osgl.util.C; //导入方法依赖的package包/类
private static Map<Subject, Integer> randomScores() {
Map<Subject, Integer> scores = C.newMap();
scores.put(Subject.ENGLISH, 60 + N.randInt(40));
scores.put(Subject.MATH, 60 + N.randInt(40));
scores.put(Subject.SCIENCE, 60 + N.randInt(40));
return scores;
}
示例6: flip
import org.osgl.util.C; //导入方法依赖的package包/类
protected static <T> Map<T, String> flip(Map<String, T> map) {
Map ret = C.newMap();
for (Map.Entry<String, T> entry : map.entrySet()) {
ret.put(entry.getValue(), entry.getKey());
}
return ret;
}
示例7: create
import org.osgl.util.C; //导入方法依赖的package包/类
public static UploadFileStorageService create(App app) {
File tmp = app.tmpDir();
if (!tmp.exists() && !tmp.mkdirs()) {
throw E.unexpected("Cannot create tmp dir");
}
Map<String, String> conf = C.newMap("storage.fs.home.dir", Files.file(app.tmpDir(), "uploads").getAbsolutePath(),
"storage.keygen", KeyGenerator.Predefined.BY_DATE.name());
conf.put(IStorageService.CONF_ID, "__upload");
conf.put("storage.storeSuffix", "false");
return new UploadFileStorageService(conf, app.config().uploadInMemoryCacheThreshold());
}
示例8: get
import org.osgl.util.C; //导入方法依赖的package包/类
@Override
public C.Map<?, ?> get() {
return C.newMap();
}
示例9: setScores
import org.osgl.util.C; //导入方法依赖的package包/类
public void setScores(Map<Subject, Integer> scores) {
this.scores = C.newMap(scores);
}
示例10: prepare
import org.osgl.util.C; //导入方法依赖的package包/类
@Before
public void prepare() {
conf = C.newMap((Map)System.getProperties());
conf.putAll(System.getenv());
}