config/config/src/test/java/beanconfig/ValuesConfig.java
Havoc Pennington b692e988a6 ConfigBeanFactory: comprehensively list allowed types
We want to avoid ever getting a ClassCastException, instead we
want a more helpful error. So write out all types explicitly.
This also will make it easier to ensure that tests are
comprehensive, and this commit adds a lot more tests.
This commit now supports typesafe List<T>, and allows you
to have fields of type Object, ConfigObject, Config, ConfigValue,
and Map<String,Object>, so if you want to accept "anything" you
can do that by specifying a vague type and then casting it yourself.
2015-03-02 09:45:39 -05:00

69 lines
1.4 KiB
Java

package beanconfig;
import java.util.Map;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigList;
import com.typesafe.config.ConfigObject;
import com.typesafe.config.ConfigValue;
// test bean for various "uncooked" values
public class ValuesConfig {
Object obj;
Config config;
ConfigObject configObj;
ConfigValue configValue;
ConfigList list;
Map<String,Object> unwrappedMap;
public Object getObj() {
return obj;
}
public void setObj(Object obj) {
this.obj = obj;
}
public Config getConfig() {
return config;
}
public void setConfig(Config config) {
this.config = config;
}
public ConfigObject getConfigObj() {
return configObj;
}
public void setConfigObj(ConfigObject configObj) {
this.configObj = configObj;
}
public ConfigValue getConfigValue() {
return configValue;
}
public void setConfigValue(ConfigValue configValue) {
this.configValue = configValue;
}
public ConfigList getList() {
return list;
}
public void setList(ConfigList list) {
this.list = list;
}
public Map<String, Object> getUnwrappedMap() {
return unwrappedMap;
}
public void setUnwrappedMap(Map<String, Object> unwrappedMap) {
this.unwrappedMap = unwrappedMap;
}
}