Package io.debezium.connector.postgresql
Class PostgresType
- java.lang.Object
-
- io.debezium.connector.postgresql.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPostgresType.Builder
-
Field Summary
Fields Modifier and Type Field Description private PostgresTypeelementTypeprivate List<String>enumValuesprivate intjdbcIdprivate intmodifiersprivate Stringnameprivate intoidprivate PostgresTypeparentTypeprivate org.postgresql.core.TypeInfotypeInfostatic PostgresTypeUNKNOWN
-
Constructor Summary
Constructors Modifier Constructor Description privatePostgresType(String name, int oid, int jdbcId, int modifiers, org.postgresql.core.TypeInfo typeInfo, List<String> enumValues, PostgresType parentType, PostgresType elementType)privatePostgresType(String name, int oid, int jdbcId, org.postgresql.core.TypeInfo typeInfo, List<String> enumValues, PostgresType parentType, PostgresType elementType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)intgetDefaultLength()intgetDefaultScale()PostgresTypegetElementType()List<String>getEnumValues()intgetJdbcId()StringgetName()intgetOid()PostgresTypegetParentType()PostgresTypegetRootType()org.postgresql.core.TypeInfogetTypeInfo()Get the underlying postgres type information objectinthashCode()booleanisArrayType()booleanisEnumType()booleanisRootType()The type system allows for the creation of user defined types (UDTs) which can be based on any existing type.intlength(int modifier)intscale(int modifier)StringtoString()
-
-
-
Field Detail
-
UNKNOWN
public static final PostgresType UNKNOWN
-
name
private final String name
-
oid
private final int oid
-
jdbcId
private final int jdbcId
-
parentType
private final PostgresType parentType
-
elementType
private final PostgresType elementType
-
typeInfo
private final org.postgresql.core.TypeInfo typeInfo
-
modifiers
private final int modifiers
-
-
Constructor Detail
-
PostgresType
private PostgresType(String name, int oid, int jdbcId, org.postgresql.core.TypeInfo typeInfo, List<String> enumValues, PostgresType parentType, PostgresType elementType)
-
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
-
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
-
-