Possible Duplicate:
Switch Statement with Strings in Java
Im using the following code and I wonder if there is a way to do it with switch , the reason that I don't use it as default since type name is type string.(I know that this option is supported in 1.7 version but I need to use 1.6) There is a way to overcome this problem ?
public static SwitchInputType<?> switchInput(String typeName) {
if (typeName.equals("Binary")) {
return new SwitchInputType<Byte>(new Byte("23ABFF"));
}
else if (typeName.equals("Decimal")) {
return new SwitchInputType<BigDecimal>(new BigDecimal("A"));
}
else if (typeName.equals("Boolean")) {
return new SwitchInputType<Boolean>(new Boolean("true"));