Remove Byte and Short support from beans for now

The right way to do these would be analogous to getInt, that is,
with a getter on Config that checks the range and throws the
right exception if the range is incorrect. But, I hesitate to
add getByte, getShort, getByteList, getShortList all to Config,
since they don't seem super useful. If we do want them though,
they should be added to beans and to Config at the same time,
so they are completely parallel to how Integer and Long work.
This commit is contained in:
Havoc Pennington 2015-02-27 14:08:56 -05:00
parent 82fcfe3f5a
commit 4c9d5aae4f
3 changed files with 0 additions and 48 deletions

View File

@ -109,10 +109,6 @@ public class ConfigBeanImpl {
private static Object getValueWithAutoConversion(Class parameterClass, Config config, String configPropName) {
if (parameterClass == Boolean.class || parameterClass == boolean.class) {
return config.getBoolean(configPropName);
} else if (parameterClass == Byte.class || parameterClass == byte.class) {
return Integer.valueOf(config.getInt(configPropName)).byteValue();
} else if (parameterClass == Short.class || parameterClass == short.class) {
return Integer.valueOf(config.getInt(configPropName)).shortValue();
} else if (parameterClass == Integer.class || parameterClass == int.class) {
return config.getInt(configPropName);
} else if (parameterClass == Double.class || parameterClass == double.class) {
@ -134,10 +130,6 @@ public class ConfigBeanImpl {
private static ConfigValueType getValueTypeOrNull(Class<?> parameterClass) {
if (parameterClass == Boolean.class || parameterClass == boolean.class) {
return ConfigValueType.BOOLEAN;
} else if (parameterClass == Byte.class || parameterClass == byte.class) {
return ConfigValueType.NUMBER;
} else if (parameterClass == Short.class || parameterClass == short.class) {
return ConfigValueType.NUMBER;
} else if (parameterClass == Integer.class || parameterClass == int.class) {
return ConfigValueType.NUMBER;
} else if (parameterClass == Double.class || parameterClass == double.class) {

View File

@ -4,10 +4,6 @@ package beanconfig;
public class NumbersConfig {
private byte byteVal;
private Byte byteObj;
private short shortVal;
private Short shortObj;
private int intVal;
private Integer intObj;
private long longVal;
@ -63,36 +59,4 @@ public class NumbersConfig {
public void setDoubleObj(Double doubleObj) {
this.doubleObj = doubleObj;
}
public byte getByteVal() {
return byteVal;
}
public void setByteVal(byte byteVal) {
this.byteVal = byteVal;
}
public Byte getByteObj() {
return byteObj;
}
public void setByteObj(Byte byteObj) {
this.byteObj = byteObj;
}
public short getShortVal() {
return shortVal;
}
public void setShortVal(short shortVal) {
this.shortVal = shortVal;
}
public Short getShortObj() {
return shortObj;
}
public void setShortObj(Short shortObj) {
this.shortObj = shortObj;
}
}

View File

@ -74,10 +74,6 @@ class ConfigBeanFactoryTest extends TestUtils {
def testCreateNumber() {
val beanConfig: NumbersConfig = ConfigBeanFactory.create(loadConfig().getConfig("numbers"), classOf[NumbersConfig])
assertNotNull(beanConfig)
assertEquals(1: Byte, beanConfig.getByteVal)
assertEquals(1: Byte, beanConfig.getByteObj)
assertEquals(2: Short, beanConfig.getShortVal)
assertEquals(2: Short, beanConfig.getShortObj)
assertEquals(3, beanConfig.getIntVal)
assertEquals(3, beanConfig.getIntObj)