base/common/src/main/com/thesett/common/util/TypeConverter.java
public static Object convert(MultiTypeData d, Class c)
    {
        // Check if it is an boolean convertion.
        if (((d.typeFlags & BOOLEAN) != 0) && (Boolean.TYPE.equals(c) || Boolean.class.equals(c)))
        {
            return d.booleanValue;
        }

        // Check if it is an int convertion.
        else if (((d.typeFlags & INT) != 0) && (Integer.TYPE.equals(c) || Integer.class.equals(c)))
        {
            return d.intValue;
        }

        // Check if it is an char convertion.
        else if (((d.typeFlags & CHAR) != 0) && (Character.TYPE.equals(c) || Character.class.equals(c)))
        {
            return d.charValue;
        }

        // Check if it is an byte convertion.
        else if (((d.typeFlags & BYTE) != 0) && (Byte.TYPE.equals(c) || Byte.class.equals(c)))
        {
            return d.byteValue;
        }

        // Check if it is an short convertion.
        else if (((d.typeFlags & SHORT) != 0) && (Short.TYPE.equals(c) || Short.class.equals(c)))
        {
            return d.shortValue;
        }

        // Check if it is an long convertion.
        else if (((d.typeFlags & LONG) != 0) && (Long.TYPE.equals(c) || Long.class.equals(c)))
        {
            return d.longValue;
        }

        // Check if it is an float convertion.
        else if (((d.typeFlags & FLOAT) != 0) && (Float.TYPE.equals(c) || Float.class.equals(c)))
        {
            return d.floatValue;
        }

        // Check if it is an double convertion.
        else if (((d.typeFlags & DOUBLE) != 0) && (Double.TYPE.equals(c) || Double.class.equals(c)))
        {
            return d.doubleValue;
        }

        // Check if it is a string convertion.
        else if (((d.typeFlags & STRING) != 0) && String.class.equals(c))
        {
            return d.stringValue;
        }

        // Check if it is an object convertion and th object types match.
        else if (((d.typeFlags & OBJECT) != 0) && d.objectValue.getClass().equals(c))
        {
            return d.objectValue;
        }

        // Throw a class cast exception if the multi data type cannot be converted to the specified class.
        else
        {
            throw new ClassCastException("The multi data type, " + d + ", cannot be converted to the class, " + c +
                ".");
        }
    }
public static Object convert(MultiTypeData d, Class c)
    {
        // Check if it is an boolean convertion.
        if (((d.typeFlags & BOOLEAN) != 0) && (Boolean.TYPE.equals(c) || Boolean.class.equals(c)))
        {
            return d.booleanValue;
        }

        // Check if it is an int convertion.
        else if (((d.typeFlags & INT) != 0) && (Integer.TYPE.equals(c) || Integer.class.equals(c)))
        {
            return d.intValue;
        }

        // Check if it is an char convertion.
        else if (((d.typeFlags & CHAR) != 0) && (Character.TYPE.equals(c) || Character.class.equals(c)))
        {
            return d.charValue;
        }

        // Check if it is an byte convertion.
        else if (((d.typeFlags & BYTE) != 0) && (Byte.TYPE.equals(c) || Byte.class.equals(c)))
        {
            return d.byteValue;
        }

        // Check if it is an short convertion.
        else if (((d.typeFlags & SHORT) != 0) && (Short.TYPE.equals(c) || Short.class.equals(c)))
        {
            return d.shortValue;
        }

        // Check if it is an long convertion.
        else if (((d.typeFlags & LONG) != 0) && (Long.TYPE.equals(c) || Long.class.equals(c)))
        {
            return d.longValue;
        }

        // Check if it is an float convertion.
        else if (((d.typeFlags & FLOAT) != 0) && (Float.TYPE.equals(c) || Float.class.equals(c)))
        {
            return d.floatValue;
        }

        // Check if it is an double convertion.
        else if (((d.typeFlags & DOUBLE) != 0) && (Double.TYPE.equals(c) || Double.class.equals(c)))
        {
            return d.doubleValue;
        }

        // Check if it is a string convertion.
        else if (((d.typeFlags & STRING) != 0) && String.class.equals(c))
        {
            return d.stringValue;
        }

        // Check if it is an object convertion and th object types match.
        else if (((d.typeFlags & OBJECT) != 0) && d.objectValue.getClass().equals(c))
        {
            return d.objectValue;
        }

        // Throw a class cast exception if the multi data type cannot be converted to the specified class.
        else
        {
            throw new ClassCastException("The multi data type, " + d + ", cannot be converted to the class, " + c +
                ".");
        }
    }
Given a multi type data object and a class representing a type, this method attemps to return an object of that
class created from the multi type data. The exception to this rule is if the specified data type is a primtive
type, such as int.clas, then the returned object will be of the equivalent wrapper class type, Integer.class in
this case. This is because a primitive cannot be returned under an Object return type.

@param     d The multi type data object to convert.
@param     c The class to convert to.

@return    An object of the specified class which is the result of converting the multi type data object to that
class.

@exception ClassCastException Is thrown if the multi type data object cannot be converted to the specified class.