public class DataTable.Schema extends java.lang.Object implements DataListener
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,DataAttribute> |
ATTRIBUTE_TABLE
map of attributes keyed by name
|
protected java.util.Collection<java.lang.String> |
PRIMARY_KEYS
collection of primary keys
|
| Constructor and Description |
|---|
Schema()
Empty Constructor
|
Schema(java.util.Collection<DataAttribute> attributes)
Primary constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(DataAttribute attribute)
Add a new attribute to the schema
|
java.util.Collection<DataAttribute> |
attributes()
Get the collection of all attributes in this schema
|
java.lang.String |
dataLabel()
Get the data label.
|
boolean |
isPrimaryKey(java.lang.String key)
Determine if the specified key is a primary key
|
java.util.Set<java.lang.String> |
keys()
Get all of the keys for the schema.
|
java.util.Collection<java.lang.String> |
primaryKeys()
Get the collection of primary keys
|
void |
update(DataAdaptor schemaAdaptor)
Update the schema from the data adaptor.
|
protected void |
validatePrimaryKeys()
Validate that the primary keys are defined for this schema.
|
void |
write(DataAdaptor schemaAdaptor)
Write the schema out to the data adaptor.
|
protected final java.util.Map<java.lang.String,DataAttribute> ATTRIBUTE_TABLE
protected final java.util.Collection<java.lang.String> PRIMARY_KEYS
public Schema()
public Schema(java.util.Collection<DataAttribute> attributes) throws MissingPrimaryKeyException
MissingPrimaryKeyExceptionpublic java.util.Set<java.lang.String> keys()
protected void validatePrimaryKeys()
throws MissingPrimaryKeyException
MissingPrimaryKeyExceptionpublic java.util.Collection<DataAttribute> attributes()
public void addAttribute(DataAttribute attribute)
attribute - The attribute to add to the schemapublic java.util.Collection<java.lang.String> primaryKeys()
public boolean isPrimaryKey(java.lang.String key)
key - The key to test for being a primary keypublic java.lang.String dataLabel()
dataLabel in interface DataListenerpublic void update(DataAdaptor schemaAdaptor) throws MissingPrimaryKeyException
update in interface DataListenerschemaAdaptor - The adaptor from which to update the dataMissingPrimaryKeyExceptionpublic void write(DataAdaptor schemaAdaptor) throws MissingPrimaryKeyException
write in interface DataListenerschemaAdaptor - The adaptor to which the receiver's data is writtenMissingPrimaryKeyException