Class Oid

  • All Implemented Interfaces:
    Serializable

    public class Oid
    extends Number
    The Oid correspons to the internal PostgreSQL Oid. Should the size of that change from 32 bit, this class must change too. In Java, the InvalidOid is represented as null.
    Author:
    Thomas Hallgren
    See Also:
    Serialized Form
    • Constructor Detail

      • Oid

        public Oid​(int value)
    • Method Detail

      • forJavaObject

        public static Oid forJavaObject​(Object obj)
                                 throws SQLException
        Finds the PostgreSQL well known Oid for the given Java object.
        Parameters:
        obj - The object.
        Returns:
        The well known Oid or null if no such Oid could be found.
        Throws:
        SQLException
      • forTypeName

        public static Oid forTypeName​(String typeString)
                               throws SQLException
        Finds the PostgreSQL well known Oid for a type name.
        Parameters:
        typeString - The name of the type, optionally qualified with a namespace.
        Returns:
        The well known Oid.
        Throws:
        SQLException - if the type could not be found
      • forSqlType

        public static Oid forSqlType​(int sqlType)
                              throws SQLException
        Finds the PostgreSQL well known Oid for the XOPEN Sql type.
        Parameters:
        sqlType - The XOPEN type code.
        Throws:
        SQLException - if the type could not be found
      • getTypeId

        public static Oid getTypeId()
        Returns the PostgreSQL type id for the Oid type.
      • registerType

        public static void registerType​(Class clazz,
                                        Oid typeId)
        A Type well known to PostgreSQL but not known as a standard XOPEN SQL type can be registered here. This includes types like the Oid itself and all the geometry related types.
        Parameters:
        clazz - The Java class that corresponds to the type id.
        typeId - The well known type id.
      • doubleValue

        public double doubleValue()
        Specified by:
        doubleValue in class Number
      • equals

        public boolean equals​(Object o)
        Checks to see if the other object is an Oid, and if so, if the native value of that Oid equals the native value of this Oid.
        Overrides:
        equals in class Object
        Returns:
        true if the objects are equal.
      • floatValue

        public float floatValue()
        Specified by:
        floatValue in class Number
      • hashCode

        public int hashCode()
        The native value is used as the hash code.
        Overrides:
        hashCode in class Object
        Returns:
        The hashCode for this Oid.
      • intValue

        public int intValue()
        Specified by:
        intValue in class Number
      • longValue

        public long longValue()
        Specified by:
        longValue in class Number
      • toString

        public String toString()
        Returns a string representation of this OID.
        Overrides:
        toString in class Object