Java Utililty Methods Object Type Case

List of utility methods to do Object Type Case

Description

The list of methods to do Object Type Case are organized into topic(s).

Method

bytecast(int value)
cast
return value > Byte.MAX_VALUE ? Byte.MAX_VALUE : value < Byte.MIN_VALUE ? Byte.MIN_VALUE : (byte) value;
intcast(long value)
cast
return value > Integer.MAX_VALUE ? Integer.MAX_VALUE
        : value < Integer.MIN_VALUE ? Integer.MIN_VALUE : (int) value;
Tcast(Object inValue)
cast
return cast(inValue, null);
Tcast(Object o)
Perform an unchecked cast.
return (T) o;
Tcast(Object o, Class clazz)
cast
if (o == null || clazz == null || !clazz.isAssignableFrom(o.getClass()))
    return null;
return clazz.cast(o);
Tcast(Object o, Class klass)
Cast an object savely.
if (klass.isInstance(o)) {
    return (T) o;
return null;
Tcast(Object o, String clazz)
cast
return (T) Class.forName(clazz).cast(o);
Tcast(Object obj, Class clazz)
From a type point of view, this works ...
return clazz.cast(obj);
Tcast(Object obj, Class type)
cast
return type.isInstance(obj) ? type.cast(obj) : null;
Tcast(Object object)
Type casts an input object to class indicated by TypeToken
return (T) (object);