public interface SchemaTable
While not required, the SDK recommends defining the database tables in your application (or service) via an enum class (as does the SDK itself).
Modifier and Type | Method and Description |
---|---|
default int |
getColumnCount()
Returns the count of the table's fields (aka columns).
|
java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> |
getColumnDefns()
Returns this table's column definitions.
|
java.util.List<java.lang.String> |
getColumnNames()
Returns a list of the table's field (aka column) names.
|
static java.util.List<java.lang.String> |
getColumnNames(java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> defns)
Returns a list of table column name extracted from the list of table column definitions.
|
javax.sql.DataSource |
getDataSource()
Returns a the data source containing this table.
|
java.lang.String |
getDataSourceType()
Returns the DataSourceType of this table.
|
SdkDataSourceWrapper |
getDataSourceWrapper()
Returns the data source wrapper.
|
static java.lang.String |
getName(java.lang.Enum<?> enumElt) |
static java.lang.String |
getPkName(java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> defns)
Returns the name of the primary key found in a table's column definitions
|
java.lang.String |
getPrimaryKeyName()
Returns the name of this table's primary key; or null if none.
|
static int |
getRequiredColumnCount(java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> defns) |
static SchemaTable |
getTableForType(java.lang.Enum<?> type)
Returns the SchemaTable type tagged with a specified Enum type.
|
java.lang.String |
getTableName()
Return this table's name as it appears in the database
|
default java.lang.Enum<?>[] |
getTypes()
Returns the list of enum values associated with this table.
|
default boolean |
hasPrimaryKey()
Returns whether this table contains a primary key.
|
void |
init(DataSourceRegistry dsr)
Sets the data source registry and provides post-constructor setup
which depends on that registry.
|
boolean |
isExactFieldCountRequired() |
static boolean |
isPrimaryKey(java.lang.Enum<?> enumElt)
Returns whether a particular column definition specifies that it is a primary key.
|
void init(DataSourceRegistry dsr)
dsr
- The data source registryjavax.sql.DataSource getDataSource()
SdkDataSourceWrapper getDataSourceWrapper()
java.lang.String getDataSourceType()
java.lang.String getTableName()
java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> getColumnDefns()
java.lang.String getPrimaryKeyName()
java.util.List<java.lang.String> getColumnNames()
boolean isExactFieldCountRequired()
default boolean hasPrimaryKey()
default java.lang.Enum<?>[] getTypes()
default int getColumnCount()
static java.util.List<java.lang.String> getColumnNames(java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> defns)
defns
- Column definitionsstatic int getRequiredColumnCount(java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> defns)
static java.lang.String getPkName(java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> defns)
defns
- Column definitionsstatic SchemaTable getTableForType(java.lang.Enum<?> type)
For example: Find the SchemaTable type tagged with ExternalReferenceType.GROUP.
type
- Enum type to look for among the schema tables.static java.lang.String getName(java.lang.Enum<?> enumElt)
static boolean isPrimaryKey(java.lang.Enum<?> enumElt)
enumElt
- Column definition