本文整理汇总了Java中com.addthis.codec.config.Configs类的典型用法代码示例。如果您正苦于以下问题:Java Configs类的具体用法?Java Configs怎么用?Java Configs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Configs类属于com.addthis.codec.config包,在下文中一共展示了Configs类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: indexThenNested
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Test
public void indexThenNested() throws Exception {
Bundle bundle = makeListBundleWithOrder();
AutoField writeField = Configs.decodeObject(AutoField.class, "auto = c.sub-field");
writeField.setValue(bundle, ValueFactory.create("sub-value"));
AutoField field = Configs.decodeObject(AutoField.class, "index = 2/sub-field");
assertEquals("sub-value", field.getValue(bundle).asNative());
}
示例2: setEmptyMap
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Test
public void setEmptyMap() throws Exception {
SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from.const: {}, to: some-field");
Bundle b = new ListBundle();
filter.filter(b);
assertEquals(Configs.newDefault(ValueMap.class), AutoField.newAutoField("some-field").getValue(b));
}
示例3: setKeyFromValue
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Test
public void setKeyFromValue() throws Exception {
SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from.const: foobar, to: MAP/mykey");
Bundle b = new ListBundle();
ValueMap map = ValueFactory.createMap();
b.setValue(b.getFormat().getField("MAP"), map);
b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("blah"));
filter.filter(b);
assertEquals("foobar", map.get("mykey").asNative());
}
示例4: replaceKeyFromValue
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Test
public void replaceKeyFromValue() throws Exception {
SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from.const:foobar, to:MAP.mykey");
Bundle b = new ListBundle();
ValueMap map = ValueFactory.createMap();
map.put("mykey",ValueFactory.create("abc"));
b.setValue(b.getFormat().getField("MAP"), map);
b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("blah"));
filter.filter(b);
assertEquals("foobar", map.get("mykey").asNative());
}
示例5: setKey
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Test
public void setKey() throws Exception {
SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from: MYFIELD, to: MAP.mykey");
Bundle b = new ListBundle();
ValueMap map = ValueFactory.createMap();
b.setValue(b.getFormat().getField("MAP"), map);
b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("foobar"));
filter.filter(b);
assertEquals("foobar", map.get("mykey").asNative());
}
示例6: replaceKey
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Test
public void replaceKey() throws Exception {
SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from: MYFIELD, to: MAP.mykey");
Bundle b = new ListBundle();
ValueMap map = ValueFactory.createMap();
map.put("mykey",ValueFactory.create("abc"));
b.setValue(b.getFormat().getField("MAP"), map);
b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("foobar"));
filter.filter(b);
assertEquals("foobar", map.get("mykey").asNative());
}
示例7: notMap
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Test(expected = Exception.class)
public void notMap() throws Exception {
SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from: MYFIELD, to:MAP.mykey");
Bundle b = new ListBundle();
b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("blah"));
filter.filter(b);
}
示例8: decodeMap
import com.addthis.codec.config.Configs; //导入依赖的package包/类
public static ValueMap decodeMap(@Syntax("HOCON") String config) throws IOException {
return Configs.decodeObject(ValueMap.class, config);
}
示例9: decode
import com.addthis.codec.config.Configs; //导入依赖的package包/类
public static MapBundle decode(@Syntax("HOCON") String config) throws IOException {
return Configs.decodeObject(MapBundle.class, config);
}
示例10: decode
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Scaling(SETUP)
public static Bundle decode(@Syntax("HOCON") String config) throws IOException {
return Configs.decodeObject(Bundle.class, config);
}
示例11: accessByIndex
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Test
public void accessByIndex() throws Exception {
Bundle bundle = makeListBundleWithOrder();
AutoField field = Configs.decodeObject(AutoField.class, "index = 1");
assertEquals("there", field.getValue(bundle).asNative());
}
示例12: createSampleFilter
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Override protected SimpleCopyFilter createSampleFilter() throws IOException {
return Configs.decodeObject(SimpleCopyFilter.class, "from.const {codec = good}, to = [b, sub-b]");
}
示例13: createSampleFilter
import com.addthis.codec.config.Configs; //导入依赖的package包/类
@Override protected SimpleCopyFilter createSampleFilter() throws IOException {
return Configs.decodeObject(SimpleCopyFilter.class, "from = [a, 0], to = [b, sub-b]");
}
示例14: createSampleFilter
import com.addthis.codec.config.Configs; //导入依赖的package包/类
protected SimpleCopyFilter createSampleFilter() throws IOException {
return Configs.decodeObject(SimpleCopyFilter.class, "from = a, to = b");
}