public static Object convert ( Object src , Class trgClass , RefInteger rating ) throws PageException { if ( rating != null ) { Object trg = _convert ( src , trgClass ) ; if ( src == trg ) { rating . plus ( 10 ) ; return trg ; } if ( src == null || trg == null ) { rating . plus ( 0 ) ; return trg ; } if ( isInstaneOf ( src . getClass ( ) , trg . getClass ( ) ) ) { rating . plus ( 9 ) ; return trg ; } if ( src . equals ( trg ) ) { rating . plus ( 8 ) ; return trg ; } // different number boolean bothNumbers = src instanceof Number && trg instanceof Number ; if ( bothNumbers && ( ( Number ) src ) . doubleValue ( ) == ( ( Number ) trg ) . doubleValue ( ) ) { rating . plus ( 7 ) ; return trg ; } String sSrc = Caster . toString ( src , null ) ; String sTrg = Caster . toString ( trg , null ) ; if ( sSrc != null && sTrg != null ) { // different number types if ( src instanceof Number && trg instanceof Number && sSrc . equals ( sTrg ) ) { rating . plus ( 6 ) ; return trg ; } // looks the same if ( sSrc . equals ( sTrg ) ) { rating . plus ( 5 ) ; return trg ; } if ( sSrc . equalsIgnoreCase ( sTrg ) ) { rating . plus ( 4 ) ; return trg ; } } // CF Equal try { if ( Operator . equals ( src , trg , false , true ) ) { rating . plus ( 3 ) ; return trg ; } } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } return trg ; } return _convert ( src , trgClass ) ; }
convert Object from src to trg Type if possible