public static Long asLong(Object obj){
  if (obj == null) {
    return null;
  }
  if (obj instanceof Integer) {
    return Long.valueOf((Integer)obj);
  }
  if (obj instanceof Long) {
    return (Long)obj;
  }
  throw new ClassCastException("Expected value of type Long or Integer");
}

public static Long asLong ( Object obj ) { if ( obj == null ) { return null ; } if ( obj instanceof Integer ) { return Long . valueOf ( ( Integer ) obj ) ; } if ( obj instanceof Long ) { return ( Long ) obj ; } throw new ClassCastException ( "Expected value of type Long or Integer" ) ; }
converts a json - parsed number ( sometimes integer , sometimes long ) to a nullable long .
