public static Long toLong(Object o,Long defaultValue){
  if (o instanceof Long)   return (Long)o;
  if (defaultValue != null)   return Long.valueOf(toLongValue(o,defaultValue.longValue()));
  long res=toLongValue(o,Long.MIN_VALUE);
  if (res == Long.MIN_VALUE)   return defaultValue;
  return Long.valueOf(res);
}

public static Long toLong ( Object o , Long defaultValue ) { if ( o instanceof Long ) return ( Long ) o ; if ( defaultValue != null ) return Long . valueOf ( toLongValue ( o , defaultValue . longValue ( ) ) ) ; long res = toLongValue ( o , Long . MIN_VALUE ) ; if ( res == Long . MIN_VALUE ) return defaultValue ; return Long . valueOf ( res ) ; }
cast a object to a long object ( reference type )
