com.revusky.niggle.data
Interface RecordDescriptor

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
RecordMetadata

public interface RecordDescriptor
extends java.io.Serializable

A metadata object that describes what is in a record.

Author:
Jonathan Revusky

Method Summary
 FieldDescriptor getField(int i)
           
 FieldDescriptor getField(java.lang.String name)
           
 java.util.Enumeration getFieldDescriptors()
           
 java.lang.Class getPresentationWrapperClass()
           
 FieldDescriptor getPrimaryKeyField()
           
 java.lang.Class getRecordClass()
           
 java.lang.String getTableName()
           
 java.lang.String getType()
           
 int getVersion()
           
 int indexOf(java.lang.String name)
           
 Record newRecord()
           
 int size()
          The number of fields in the record.
 

Method Detail

getType

public java.lang.String getType()
Returns:
a string representing the type of record this is.

getVersion

public int getVersion()
Returns:
an integer representing the version number

getFieldDescriptors

public java.util.Enumeration getFieldDescriptors()
Returns:
a java.util.Enumeration of the descriptors of the fields that comprise this record.

getField

public FieldDescriptor getField(java.lang.String name)
Returns:
the FieldDescriptor based on name, or null if none is found.

getField

public FieldDescriptor getField(int i)
Returns:
the FieldDescriptor based on ordinal index.

getPrimaryKeyField

public FieldDescriptor getPrimaryKeyField()
Returns:
the FieldDescriptor for the primary key.

indexOf

public int indexOf(java.lang.String name)
Returns:
the ordinal index of the field of the given name, -1 if there is no field of that name.

size

public int size()
The number of fields in the record.

getPresentationWrapperClass

public java.lang.Class getPresentationWrapperClass()
Returns:
a custom class that is used to "wrap" this record for presentation. I anticipate that many (if not most) implementations will simply return null here and a default wrapper class will be used.

getRecordClass

public java.lang.Class getRecordClass()
Returns:
the Java class that corresponds to this record type.

newRecord

public Record newRecord()
Returns:
a Record that corresponds to this record descriptor in its default uninitialized state.

getTableName

public java.lang.String getTableName()
Returns:
the name of the table that this record type is stored in in a backing RDBMS. Under most circumstances, this will return the same as getType(), since there is little reason not to name the table the same as the underlying type.