I’m trying to build an advanced search function in an app that builds a query based on a dataType.
My potential dataTypes are FLOAT, NUMBER, CHAR, VARCHAR2, DATE, TIMESTAMP(6)
I’m trying to “code out of my shell” and instead of using an ArrayList to store the values, i was going to try and use enum since i only have these 6 values and they never change.
TIMESTAMP(6) is giving me a hard time because of the parenthesis.
How can i declare an enum value TIMESTAMP(6)?
Currently the snippet below gives me the error: the constructor TableBacking.dataTypeOptions(int) is undefined.
public enum dataTypeOptions {
FLOAT, NUMBER, CHAR, VARCHAR2, DATE, TIMESTAMP(6)
};
The enum constant names need to be valid identifiers. So you could call it
TIMESTAMP_6for example.If you later need a string representation that returns
TIMESTAMP(6)you can use a String constructor in your enum to define that value.It could look like this: