private static Object increment(final Object object,final Number amount,final JsonPointer field) throws BadRequestException {
  if (object instanceof Long) {
    return ((Long)object) + amount.longValue();
  }
 else   if (object instanceof Integer) {
    return ((Integer)object) + amount.intValue();
  }
 else   if (object instanceof Float) {
    return ((Float)object) + amount.floatValue();
  }
 else   if (object instanceof Double) {
    return ((Double)object) + amount.doubleValue();
  }
 else {
    throw new BadRequestException("The field '" + field + "' is not a number");
  }
}

private static Object increment ( final Object object , final Number amount , final JsonPointer field ) throws BadRequestException { if ( object instanceof Long ) { return ( ( Long ) object ) + amount . longValue ( ) ; } else if ( object instanceof Integer ) { return ( ( Integer ) object ) + amount . intValue ( ) ; } else if ( object instanceof Float ) { return ( ( Float ) object ) + amount . floatValue ( ) ; } else if ( object instanceof Double ) { return ( ( Double ) object ) + amount . doubleValue ( ) ; } else { throw new BadRequestException ( "The field '" + field + "' is not a number" ) ; } }
helper function to deal with typecasting and incrementing of object to appropriate number object ) .
