Record Class NativeColumnType
java.lang.Object
java.lang.Record
org.apache.cayenne.dba.NativeColumnType
public record NativeColumnType(int jdbcType, String nativeType, boolean autoIncrement, boolean unconstrained)
extends Record
Describes a single database-native (external) SQL type that a JDBC type (see
Types) maps to.
A JDBC type may map to more than one native type, e.g. a primary name plus the auto-increment variant used
for generated columns (PostgreSQL "serial"), or a primary name plus an unconstrained variant used for a
character column with no max length (PostgreSQL "text").- Since:
- 5.0
-
Constructor Summary
ConstructorsConstructorDescriptionNativeColumnType(int jdbcType, String nativeType, boolean autoIncrement, boolean unconstrained) Creates an instance of aNativeColumnTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this type flagged as the auto-increment variant, e.g.Returns a copy of this type flagged as the unconstrained variant, i.e. one that may be used for a character column with no max length and rendered without a length suffix, e.g.booleanReturns the value of theautoIncrementrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intjdbcType()Returns the value of thejdbcTyperecord component.Returns the value of thenativeTyperecord component.static NativeColumnTypeCreates a plain native type.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theunconstrainedrecord component.
-
Constructor Details
-
NativeColumnType
public NativeColumnType(int jdbcType, String nativeType, boolean autoIncrement, boolean unconstrained) Creates an instance of aNativeColumnTyperecord class.- Parameters:
jdbcType- the value for thejdbcTyperecord componentnativeType- the value for thenativeTyperecord componentautoIncrement- the value for theautoIncrementrecord componentunconstrained- the value for theunconstrainedrecord component
-
-
Method Details
-
of
Creates a plain native type. -
asAutoIncrement
Returns a copy of this type flagged as the auto-increment variant, e.g. PostgreSQL "serial" forTypes.INTEGER. Used to render generated columns. -
asUnconstrained
Returns a copy of this type flagged as the unconstrained variant, i.e. one that may be used for a character column with no max length and rendered without a length suffix, e.g. PostgreSQL "text" or MySQL "longtext". -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
jdbcType
public int jdbcType()Returns the value of thejdbcTyperecord component.- Returns:
- the value of the
jdbcTyperecord component
-
nativeType
Returns the value of thenativeTyperecord component.- Returns:
- the value of the
nativeTyperecord component
-
autoIncrement
public boolean autoIncrement()Returns the value of theautoIncrementrecord component.- Returns:
- the value of the
autoIncrementrecord component
-
unconstrained
public boolean unconstrained()Returns the value of theunconstrainedrecord component.- Returns:
- the value of the
unconstrainedrecord component
-