base/common/src/main/com/thesett/common/util/TypeConverter.java
public static MultiTypeData getMultiTypeData(String s)
    {
        MultiTypeData result = new MultiTypeData();

        // Start by assuming that the String can only be converted to a String.
        result.typeFlags = STRING;
        result.stringValue = s;

        // Assume that the native type is String. It is up to methods that call this one to override this if this is
        // not the case.
        result.nativeType = STRING;

        // Check if the string can be converted to a boolean.
        if ("true".equals(s))
        {
            result.booleanValue = true;
            result.typeFlags |= BOOLEAN;
        }
        else if ("false".equals(s))
        {
            result.booleanValue = false;
            result.typeFlags |= BOOLEAN;
        }

        // Check if the string can be converted to an int.
        try
        {
            result.intValue = Integer.parseInt(s);
            result.typeFlags |= INT;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags &= (Integer.MAX_VALUE - INT);
        }

        // Check if the string can be converted to a byte.
        try
        {
            result.byteValue = Byte.parseByte(s);
            result.typeFlags |= BYTE;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - BYTE);
        }

        // Check if the string can be converted to a char.
        if (s.length() == 1)
        {
            result.charValue = s.charAt(0);
            result.typeFlags |= CHAR;
        }

        // Check if the string can be converted to a short.
        try
        {
            result.shortValue = Short.parseShort(s);
            result.typeFlags |= SHORT;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - SHORT);
        }

        // Check if the string can be converted to a long.
        try
        {
            result.longValue = Long.parseLong(s);
            result.typeFlags |= LONG;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - LONG);
        }

        // Check if the string can be converted to a float.
        try
        {
            result.floatValue = Float.parseFloat(s);
            result.typeFlags |= FLOAT;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - FLOAT);
        }

        // Check if the string can be converted to a double.
        try
        {
            result.doubleValue = Double.parseDouble(s);
            result.typeFlags |= DOUBLE;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - DOUBLE);
        }

        // Assume the string can never be converted to an object.
        return result;
    }
public static MultiTypeData getMultiTypeData(String s)
    {
        MultiTypeData result = new MultiTypeData();

        // Start by assuming that the String can only be converted to a String.
        result.typeFlags = STRING;
        result.stringValue = s;

        // Assume that the native type is String. It is up to methods that call this one to override this if this is
        // not the case.
        result.nativeType = STRING;

        // Check if the string can be converted to a boolean.
        if ("true".equals(s))
        {
            result.booleanValue = true;
            result.typeFlags |= BOOLEAN;
        }
        else if ("false".equals(s))
        {
            result.booleanValue = false;
            result.typeFlags |= BOOLEAN;
        }

        // Check if the string can be converted to an int.
        try
        {
            result.intValue = Integer.parseInt(s);
            result.typeFlags |= INT;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags &= (Integer.MAX_VALUE - INT);
        }

        // Check if the string can be converted to a byte.
        try
        {
            result.byteValue = Byte.parseByte(s);
            result.typeFlags |= BYTE;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - BYTE);
        }

        // Check if the string can be converted to a char.
        if (s.length() == 1)
        {
            result.charValue = s.charAt(0);
            result.typeFlags |= CHAR;
        }

        // Check if the string can be converted to a short.
        try
        {
            result.shortValue = Short.parseShort(s);
            result.typeFlags |= SHORT;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - SHORT);
        }

        // Check if the string can be converted to a long.
        try
        {
            result.longValue = Long.parseLong(s);
            result.typeFlags |= LONG;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - LONG);
        }

        // Check if the string can be converted to a float.
        try
        {
            result.floatValue = Float.parseFloat(s);
            result.typeFlags |= FLOAT;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - FLOAT);
        }

        // Check if the string can be converted to a double.
        try
        {
            result.doubleValue = Double.parseDouble(s);
            result.typeFlags |= DOUBLE;
        }
        catch (NumberFormatException e)
        {
            // Exception noted so can be ignored.
            e = null;

            result.typeFlags = (Integer.MAX_VALUE - DOUBLE);
        }

        // Assume the string can never be converted to an object.
        return result;
    }
Converts a String into a multi type data object.

<p/>This method will return the native type as String. Methods that use this one to convert other types via
String should override this with the correct native type.

@param  s The String to convert.

@return A multi type data object holding all the types that the String can be converted into.