Package org.zalando.typemapper.postgres
Class PgTypeHelper
java.lang.Object
org.zalando.typemapper.postgres.PgTypeHelper
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PgRowasPGobject(Object o) static PgRowasPGobject(Object o, String typeHint) static PgRowasPGobject(Object o, String typeHint, Connection connection) static PgRowasPGobject(Object o, String typeHint, Connection connection, boolean forceTypeHint) static DatabaseFieldDescriptorgetDatabaseFieldDescriptor(Field field) get the database field annotation from a given field.getObjectAttributesForPgSerialization(Object obj, String typeHint) getObjectAttributesForPgSerialization(Object obj, String typeHint, Connection connection) getObjectAttributesForPgSerialization(Object obj, String typeHint, Connection connection, boolean forceTypeHint) static StringgetSQLNameForClass(Class<?> elementClass) static final intgetSQLType(String typeName) A simple method to get an appropriate java.sql.types.* value for the given PostgreSQL type namestatic StringtoPgString(Object o) static StringtoPgString(Object o, Connection connection) Serialize an object into a PostgreSQL string.
-
Constructor Details
-
PgTypeHelper
public PgTypeHelper()
-
-
Method Details
-
getSQLType
A simple method to get an appropriate java.sql.types.* value for the given PostgreSQL type name- Parameters:
typeName-- Returns:
- SQL type
-
getSQLNameForClass
-
getObjectAttributesForPgSerialization
public static PgTypeHelper.PgTypeDataHolder getObjectAttributesForPgSerialization(Object obj, String typeHint) -
getObjectAttributesForPgSerialization
public static PgTypeHelper.PgTypeDataHolder getObjectAttributesForPgSerialization(Object obj, String typeHint, Connection connection) -
getObjectAttributesForPgSerialization
public static PgTypeHelper.PgTypeDataHolder getObjectAttributesForPgSerialization(Object obj, String typeHint, Connection connection, boolean forceTypeHint) -
getDatabaseFieldDescriptor
get the database field annotation from a given field. This function will check againstColumndefinition so that both annotations can be used to mark a DatabaseField.- Parameters:
field- the field to be checked- Returns:
- a
DatabaseFieldDescriptorbased on a foundDatabaseFieldorColumn
-
toPgString
-
toPgString
Serialize an object into a PostgreSQL string.- Parameters:
o- object to be serialized
-
asPGobject
- Throws:
SQLException
-
asPGobject
- Throws:
SQLException
-
asPGobject
public static PgRow asPGobject(Object o, String typeHint, Connection connection) throws SQLException - Throws:
SQLException
-
asPGobject
public static PgRow asPGobject(Object o, String typeHint, Connection connection, boolean forceTypeHint) throws SQLException - Throws:
SQLException
-