public Object convert(Class type,Object value){
  Class sourceType=value == null ? null : value.getClass();
  Class targetType=primitive(type == null ? getDefaultType() : type);
  value=convertArray(value);
  if (value == null) {
    return handleMissing(targetType);
  }
  sourceType=value.getClass();
  try {
    if (targetType.equals(String.class)) {
      return convertToString(value);
    }
 else     if (targetType.equals(sourceType)) {
      return value;
    }
 else {
      Object result=convertToType(targetType,value);
      return result;
    }
  }
 catch (  Throwable t) {
    return handleError(targetType,value,t);
  }
}

public Object convert ( Class type , Object value ) { Class sourceType = value == null ? null : value . getClass ( ) ; Class targetType = primitive ( type == null ? getDefaultType ( ) : type ) ; value = convertArray ( value ) ; if ( value == null ) { return handleMissing ( targetType ) ; } sourceType = value . getClass ( ) ; try { if ( targetType . equals ( String . class ) ) { return convertToString ( value ) ; } else if ( targetType . equals ( sourceType ) ) { return value ; } else { Object result = convertToType ( targetType , value ) ; return result ; } } catch ( Throwable t ) { return handleError ( targetType , value , t ) ; } }
convert the input object into an output object of the specified type .
