An application running in java 1.8 have to run in few boxes with java 1.4. The application uses a lot of constants (thousands of them) and everything is implemented using functional enums. Which is the best way to make it reverse compatible?
EDIT :
I have already seen few answers but none of them are satisfactory. So to make clear what i am trying to achieve here please take a look at the a small example as below
public class SomeType
{
public enum TYPE
{
ERROR("allError","4"),
INPUT("allInput","5"),
OFFLINE("allOffline","6"),;
private final String type;
private final String desc;
TYPE(String type, String desc)
{
this.type = type;
this.desc = desc;
}
public String getType(){
return this.type;
}
public String getDesc(){
return this.type;
}
}
}
}
Which will be consumed by something like
for (SomeType.TYPE type: SomeType.TYPE.values())
{
if(nodeValue.equalsIgnoreCase(type.getType()))
{
value=type.getDesc();
break;
}
}
So this will never be compatible in 1.4 and so i would have to write a lot of boilerplate code as explained by @Gene in the link provided by him. As there are so many classes like this holding very large list of constants in them, i feel the need for a better approach. So the question is a search for a better solution.