# 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

  Constructors
  Constructor
  Description
  `NativeColumnType(int jdbcType, String nativeType, boolean autoIncrement, boolean unconstrained)`
  Creates an instance of a `NativeColumnType` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `NativeColumnType`
  `asAutoIncrement()`
  Returns a copy of this type flagged as the auto-increment variant, e.g.
  `NativeColumnType`
  `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.
  `boolean`
  `autoIncrement()`
  Returns the value of the `autoIncrement` record component.
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `int`
  `jdbcType()`
  Returns the value of the `jdbcType` record component.
  `String`
  `nativeType()`
  Returns the value of the `nativeType` record component.
  `static NativeColumnType`
  `of(int jdbcType, String nativeType)`
  Creates a plain native type.
  `final String`
  `toString()`
  Returns a string representation of this record class.
  `boolean`
  `unconstrained()`
  Returns the value of the `unconstrained` record component.

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### NativeColumnType

    public NativeColumnType(int jdbcType, String nativeType, boolean autoIncrement, boolean unconstrained)
    Creates an instance of a `NativeColumnType` record class.
    Parameters:
      `jdbcType` - the value for the `jdbcType` record component
      `nativeType` - the value for the `nativeType` record component
      `autoIncrement` - the value for the `autoIncrement` record component
      `unconstrained` - the value for the `unconstrained` record component

- ## Method Details

  - ### of

    public static NativeColumnType of(int jdbcType, String nativeType)
    Creates a plain native type.

  - ### asAutoIncrement

    public NativeColumnType asAutoIncrement()
    Returns a copy of this type flagged as the auto-increment variant, e.g. PostgreSQL "serial" for `Types.INTEGER`. Used to render generated columns.

  - ### asUnconstrained

    public NativeColumnType 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

    public final String toString()
    Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
    Specified by:
      `toString` in class `Record`
    Returns:
      a string representation of this object

  - ### hashCode

    public final int hashCode()
    Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public final boolean equals(Object o)
    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 with `Objects::equals(Object,Object)`; primitive components are compared with the `compare` method from their corresponding wrapper classes.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `o` - the object with which to compare
    Returns:
      `true` if this object is the same as the `o` argument; `false` otherwise.

  - ### jdbcType

    public int jdbcType()
    Returns the value of the `jdbcType` record component.
    Returns:
      the value of the `jdbcType` record component

  - ### nativeType

    public String nativeType()
    Returns the value of the `nativeType` record component.
    Returns:
      the value of the `nativeType` record component

  - ### autoIncrement

    public boolean autoIncrement()
    Returns the value of the `autoIncrement` record component.
    Returns:
      the value of the `autoIncrement` record component

  - ### unconstrained

    public boolean unconstrained()
    Returns the value of the `unconstrained` record component.
    Returns:
      the value of the `unconstrained` record component