List of usage examples for org.apache.commons.jxpath.util TypeUtils canConvert
public static boolean canConvert(Object object, Class toType)
From source file:org.xchain.framework.jxpath.MethodLookupUtils.java
/** * Return a match code between an object and type. * @param expected class to test/*from w w w . j ava 2s . c om*/ * @param object object to test * @return int code */ private static int matchType(Class expected, Object object) { if (object == null) { return APPROXIMATE_MATCH; } Class actual = object.getClass(); if (expected.equals(actual)) { return EXACT_MATCH; } if (expected.isAssignableFrom(actual)) { return EXACT_MATCH; } if (TypeUtils.canConvert(object, expected)) { return APPROXIMATE_MATCH; } return NO_MATCH; }