Class JavaObjectResolver

java.lang.Object
org.postgresql.jdbc.JavaObjectResolver

public class JavaObjectResolver extends Object
The motivation behind this class is to deal with:
  • autoboxing, the type of the object is not always the same as the type of the column in the database. Ex: Object a = 1; // a is an Integer, but the oid might be INT8
  • string to internal pg object representation, check the oid if a string literal can be used to create an internal object like PGBox, PGPoint etc, since users don't have access to those types.
  • Constructor Details

    • JavaObjectResolver

      private JavaObjectResolver()
  • Method Details

    • tryResolveObject

      public static Object tryResolveObject(Object in, int oid)
      Try to resolve the object to the correct type based on the oid, otherwise return the object as is.
      Parameters:
      in - the object to resolve
      oid - the oid of the column
      Returns:
      the resolved object
    • tryResolveObjectToShort

      private static Object tryResolveObjectToShort(Object in)
    • tryResolveObjectToInt

      private static Object tryResolveObjectToInt(Object in)
    • tryResolveObjectToLong

      private static Object tryResolveObjectToLong(Object in)
    • tryResolveObjectToFloat

      private static Object tryResolveObjectToFloat(Object in)
    • tryResolveObjectToDouble

      private static Object tryResolveObjectToDouble(Object in)
    • tryToResolveObjectToBigDecimal

      private static Object tryToResolveObjectToBigDecimal(Object in)
    • tryResolveObjectToBoolean

      private static Object tryResolveObjectToBoolean(Object in)
    • tryResolveObjectToChar

      private static Object tryResolveObjectToChar(Object in)
    • tryResolveObjectToString

      private static Object tryResolveObjectToString(Object in)
    • tryToResolveObjectToPGPoint

      private static Object tryToResolveObjectToPGPoint(Object in)
    • tryToResolveObjectToPGBox

      private static Object tryToResolveObjectToPGBox(Object in)
    • tryToResolveObjectToPGObject

      private static Object tryToResolveObjectToPGObject(Object in, int oid)