public Object prepareValue ( String pExpectedClassName , Object pValue ) { if ( pValue == null ) { return null ; } else { Class expectedClass = ClassUtil . classForName ( pExpectedClassName ) ; Object param = null ; if ( expectedClass != null ) { param = prepareValue ( expectedClass , pValue ) ; } if ( param == null ) { // Ok, we try to convert it from a string // If expectedClass is null, it is probably a native type, so we // let happen the string conversion // later on (e.g. conversion of pArgument.toString()) which will throw // an exception at this point if conversion can not be done return convertFromString ( pExpectedClassName , pValue . toString ( ) ) ; } return param ; } }
Prepare a value from a either a given object or its string representation . If the value is already assignable to the given class name it is returned directly .