public final class

TableInfo.Column

extends java.lang.Object

 java.lang.Object

↳androidx.room.util.TableInfo.Column

Overview

Holds the information about a database column.

Summary

Fields
public final intaffinity

The column type after it is normalized to one of the basic types according to https://www.sqlite.org/datatype3.html Section 3.1.

public final java.lang.StringdefaultValue

The default value of this column.

public final java.lang.Stringname

The column name.

public final booleannotNull

Whether or not the column can be NULL.

public final intprimaryKeyPosition

The position of the column in the list of primary keys, 0 if the column is not part of the primary key.

public final java.lang.Stringtype

The column type affinity.

Constructors
publicColumn(java.lang.String name, java.lang.String type, boolean notNull, int primaryKeyPosition)

publicColumn(java.lang.String name, java.lang.String type, boolean notNull, int primaryKeyPosition, java.lang.String defaultValue, int createdFrom)

Methods
public static booleandefaultValueEquals(java.lang.String actual, java.lang.String other)

Checks if the default values provided match.

public booleanequals(java.lang.Object o)

public inthashCode()

public booleanisPrimaryKey()

Returns whether this column is part of the primary key or not.

public java.lang.StringtoString()

from java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait

Fields

public final java.lang.String name

The column name.

public final java.lang.String type

The column type affinity.

public final int affinity

The column type after it is normalized to one of the basic types according to https://www.sqlite.org/datatype3.html Section 3.1.

This is the value Room uses for equality check.

public final boolean notNull

Whether or not the column can be NULL.

public final int primaryKeyPosition

The position of the column in the list of primary keys, 0 if the column is not part of the primary key.

This information is only available in API 20+. (SQLite version 3.7.16.2) On older platforms, it will be 1 if the column is part of the primary key and 0 otherwise.

The TableInfo.Column.equals(Object) implementation handles this inconsistency based on API levels os if you are using a custom SQLite deployment, it may return false positives.

public final java.lang.String defaultValue

The default value of this column.

Constructors

public Column(java.lang.String name, java.lang.String type, boolean notNull, int primaryKeyPosition)

Deprecated: Use TableInfo.Column.Column(String, String, boolean, int, String, int) instead.

public Column(java.lang.String name, java.lang.String type, boolean notNull, int primaryKeyPosition, java.lang.String defaultValue, int createdFrom)

Methods

public boolean equals(java.lang.Object o)

public static boolean defaultValueEquals(java.lang.String actual, java.lang.String other)

Checks if the default values provided match. Handles the special case in which the default value is surrounded by parenthesis (e.g. encountered in b/182284899). Surrounding parenthesis are removed by SQLite when reading from the database, hence this function will check if they are present in the actual value, if so, it will compare the two values by ignoring the surrounding parenthesis.

public boolean isPrimaryKey()

Returns whether this column is part of the primary key or not.

Returns:

True if this column is part of the primary key, false otherwise.

public int hashCode()

public java.lang.String toString()