private static Object selfConvert ( String parsingMethod , String value , Class < ? > type ) { try { Method method = type . getMethod ( parsingMethod , String . class ) ; return method . invoke ( null , value ) ; } catch ( InvocationTargetException e ) { throw new IllegalArgumentException ( "Can't convert " + value + " to " + type . getName ( ) , e . getCause ( ) ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Can't convert " + value + " to " + type . getName ( ) , e ) ; } }
SelfConversion implies that if a class has the given static method named that receive a String and that returns a instance of the class then it can serve for conversion purpose .