I need a logic/algorithm based on Java which can return me the type of the input parameter. The input parameter is a text. But the function has to analyse the text and find out whether the input (can be)/is of type int, String, float or enum or an array of primitive data types.
The input parameter is: (("ABC","DEF"), (1,2,3), 5.5, (5.2, 6.2,8.8), (RED, BLUE)). Here the function should return me the result as:
DataType-1 is array of String (as the String are always represented in quotes).
DataType-2 is an array of integers
DataType-3 is of type float
DataType-4 is an array of float
DataType-5 is an array of enum, say Color. (Enum always represented without quotes)
Validation should be taken care for non-matching "(" or")". Also for mixed type datatype not allowed.
Due to time constraint this question is being asked. I am looking for some available parsers or expert solution which is failure-proof. Thanks in Advance.