com.revusky.oreo.metadata
Class RecordMetadata
java.lang.Object
|
+--com.revusky.oreo.metadata.RecordMetadata
- All Implemented Interfaces:
- RecordDescriptor, java.io.Serializable
- public class RecordMetadata
- extends java.lang.Object
- implements RecordDescriptor
An implementation of the RecordDescriptor interface.
This class knows how to instantiate itself from a DOM Element
- Author:
- Jonathan Revusky
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RecordMetadata
public RecordMetadata()
getField
public FieldDescriptor getField(java.lang.String name)
- Specified by:
getField
in interface RecordDescriptor
- Parameters:
the
- name of the field or an alias to the name
getField
public FieldDescriptor getField(int i)
- Specified by:
getField
in interface RecordDescriptor
- Following copied from interface:
com.revusky.oreo.RecordDescriptor
- Returns:
- the FieldDescriptor based
on ordinal index.
getFieldDescriptors
public java.util.Enumeration getFieldDescriptors()
- Specified by:
getFieldDescriptors
in interface RecordDescriptor
- Following copied from interface:
com.revusky.oreo.RecordDescriptor
- Returns:
- a java.util.Enumeration of the
descriptors of the fields that comprise
this record. NB: For a variety of hypertechnical reasons,
it is required that the primary key field be the
first field that comes out of the enumeration.
init
protected void init(org.w3c.dom.Element element,
java.util.Map recordData,
java.lang.ClassLoader cloader)
throws org.xml.sax.SAXException
- fill in internal state from a DOM element
- Parameters:
element
- A W3C DOM API object that represents
the XML fragment that we are processing.recordData
- a dictionary of metadata objects that have
been processed so far.cloader
- The servlet classloader if it is available, or null- Throws:
org.xml.sax.SAXException
- This implies that there is something invalid
in the XML.
processPresentationWrapper
protected void processPresentationWrapper(org.w3c.dom.Element element,
java.lang.ClassLoader cloader)
throws org.xml.sax.SAXException
processProperties
protected void processProperties(org.w3c.dom.Element element)
throws org.xml.sax.SAXException
size
public int size()
- Description copied from interface:
RecordDescriptor
- The number of fields in the record.
- Specified by:
size
in interface RecordDescriptor
indexOf
public int indexOf(java.lang.String fieldname)
- Specified by:
indexOf
in interface RecordDescriptor
- Parameters:
fieldname
- the name of the field or an alias- Returns:
- the index of the field of a given name, or -1 if it does not exist.
getPresentationWrapperClass
public java.lang.Class getPresentationWrapperClass()
- Specified by:
getPresentationWrapperClass
in interface RecordDescriptor
- Following copied from interface:
com.revusky.oreo.RecordDescriptor
- 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.
getPrimaryKeyField
public FieldDescriptor getPrimaryKeyField()
- Specified by:
getPrimaryKeyField
in interface RecordDescriptor
- Following copied from interface:
com.revusky.oreo.RecordDescriptor
- Returns:
- the FieldDescriptor
for the primary key.
getRecordClass
public java.lang.Class getRecordClass()
- Specified by:
getRecordClass
in interface RecordDescriptor
- Following copied from interface:
com.revusky.oreo.RecordDescriptor
- Returns:
- the Java class that corresponds
to this record type.
newRecord
public Record newRecord()
- Specified by:
newRecord
in interface RecordDescriptor
- Following copied from interface:
com.revusky.oreo.RecordDescriptor
- Returns:
- a Record that corresponds to
this record descriptor in its
default uninitialized state.
getType
public java.lang.String getType()
- Specified by:
getType
in interface RecordDescriptor
- Following copied from interface:
com.revusky.oreo.RecordDescriptor
- Returns:
- a string representing the type of record this is.
getTableName
public java.lang.String getTableName()
- Specified by:
getTableName
in interface RecordDescriptor
- Following copied from interface:
com.revusky.oreo.RecordDescriptor
- 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.
getProperty
public java.lang.String getProperty(java.lang.String propertyName)
- Description copied from interface:
RecordDescriptor
- a hook so that implementors can add other
properties
- Specified by:
getProperty
in interface RecordDescriptor