|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.scijava.util.ConversionUtils
public class ConversionUtils
Useful methods for converting and casting between classes and types.
For extensible type conversion, use ConvertService
.
Method Summary | ||
---|---|---|
static boolean |
canCast(Class<?> src,
Class<?> dest)
Checks whether objects of the given class can be cast to the specified type. |
|
static boolean |
canCast(Object src,
Class<?> dest)
Checks whether the given object can be cast to the specified type. |
|
static boolean |
canConvert(Class<?> src,
Class<?> dest)
Deprecated. |
|
static boolean |
canConvert(Class<?> src,
Type dest)
Deprecated. |
|
static boolean |
canConvert(Object src,
Class<?> dest)
Deprecated. |
|
static boolean |
canConvert(Object src,
Type dest)
Deprecated. |
|
static
|
cast(Object src,
Class<T> dest)
Casts the given object to the specified type, or null if the types are incompatible. |
|
static
|
convert(Object src,
Class<T> dest)
Deprecated. |
|
static Object |
convert(Object src,
Type dest)
Deprecated. |
|
static
|
convertToEnum(String src,
Class<T> dest)
Converts the given string value to an enumeration constant of the specified type. |
|
static Class<?> |
getClass(Type type)
Deprecated. use GenericUtils.getClass(Type) |
|
static Class<?> |
getComponentClass(Type type)
Deprecated. use GenericUtils.getComponentClass(Type) |
|
static
|
getNonprimitiveType(Class<T> type)
Returns the non-primitive Class closest to the given type. |
|
static
|
getNullValue(Class<T> type)
Gets the "null" value for the given type. |
|
static void |
setDelegateService(ConvertService convertService,
double priority)
Sets the ConvertService to use for handling conversion requests. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T convertToEnum(String src, Class<T> dest)
src
- The value to convert.dest
- The type of the enumeration constant.
public static <T> T cast(Object src, Class<T> dest)
public static boolean canCast(Class<?> src, Class<?> dest)
cast(Object, Class)
public static boolean canCast(Object src, Class<?> dest)
cast(Object, Class)
public static <T> Class<T> getNonprimitiveType(Class<T> type)
Class
closest to the given type.
Specifically, the following type conversions are done:
public static <T> T getNullValue(Class<T> type)
public static void setDelegateService(ConvertService convertService, double priority)
ConvertService
to use for handling conversion requests.
@Deprecated public static Object convert(Object src, Type dest)
Converter.convert(Object, Type)
@Deprecated public static <T> T convert(Object src, Class<T> dest)
Converter.convert(Object, Class)
@Deprecated public static boolean canConvert(Class<?> src, Type dest)
Converter.canConvert(Class, Type)
@Deprecated public static boolean canConvert(Class<?> src, Class<?> dest)
Converter.canConvert(Class, Class)
@Deprecated public static boolean canConvert(Object src, Type dest)
Converter.canConvert(Object, Type)
@Deprecated public static boolean canConvert(Object src, Class<?> dest)
Converter.canConvert(Object, Class)
@Deprecated public static Class<?> getClass(Type type)
GenericUtils.getClass(Type)
@Deprecated public static Class<?> getComponentClass(Type type)
GenericUtils.getComponentClass(Type)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |