Class PostgresType


  • public class PostgresType
    extends Object
    A class that binds together a PostgresSQL OID, JDBC type id and the string name of the type. The array types contain link to their element type.
    Author:
    Jiri Pechanec
    • Field Detail

      • name

        private final String name
      • oid

        private final int oid
      • jdbcId

        private final int jdbcId
      • typeInfo

        private final org.postgresql.core.TypeInfo typeInfo
      • modifiers

        private final int modifiers
      • enumValues

        private final List<String> enumValues
    • Constructor Detail

      • PostgresType

        private PostgresType​(String name,
                             int oid,
                             int jdbcId,
                             int modifiers,
                             org.postgresql.core.TypeInfo typeInfo,
                             List<String> enumValues,
                             PostgresType parentType,
                             PostgresType elementType)
    • Method Detail

      • isArrayType

        public boolean isArrayType()
        Returns:
        true if this type is an array
      • isRootType

        public boolean isRootType()
        The type system allows for the creation of user defined types (UDTs) which can be based on any existing type. When a type does not extend another type, it is considered to be a base or root type in the type hierarchy.
        Returns:
        true if this type is a base/root type
      • isEnumType

        public boolean isEnumType()
        Returns:
        true if this type is an enum type
      • getName

        public String getName()
        Returns:
        symbolic name of the type
      • getOid

        public int getOid()
        Returns:
        PostgreSQL OID of this type
      • getJdbcId

        public int getJdbcId()
        Returns:
        JDBC id of the type as reported by JDBC metadata
      • getElementType

        public PostgresType getElementType()
        Returns:
        the type of element in arrays or null for primitive types
      • getParentType

        public PostgresType getParentType()
        Returns:
        the parent postgres type this type is based upon
      • getRootType

        public PostgresType getRootType()
        Returns:
        the postgres type at the top/root level for this type's hierarchy
      • getEnumValues

        public List<String> getEnumValues()
      • getDefaultLength

        public int getDefaultLength()
        Returns:
        the default length of the type
      • getDefaultScale

        public int getDefaultScale()
        Returns:
        the default scale of the type
      • length

        public int length​(int modifier)
        Parameters:
        modifier - - type modifier coming from decoder
        Returns:
        length of the type based on the modifier
      • getTypeInfo

        public org.postgresql.core.TypeInfo getTypeInfo()
        Get the underlying postgres type information object
        Returns:
        the type information object; may be null
      • scale

        public int scale​(int modifier)
        Parameters:
        modifier - - type modifier coming from decoder
        Returns:
        scale of the type based on the modifier
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object