public interface DBObjectBuilder<T extends DBObject>
DBObjectBuilder
interface provides a mechanism for constructing new instances representing database objects.
A DBObjectProvider
can use a DBObjectBuilder to construct data model instances without needing to know how the data model is being determined. For example, a generic JDBC implementation of DBObjectBuilder for tables could use the information from DatabaseMetaData to create the model; an Oracle specific DBObjectBuilder could query the data dictionary directly; and an offline DBObjectBuilder could convert an XML file into the table data model.
DBObjectBuilder
implementations may implement lazy instantiation of the SchemaObject instances they create. A lazily instantiated SchemaObject will always have its Schema and Name properties set; however, any additional properties may not be initialized until a caller requests them. The DBObjectBuilder should set itself as the builder on the lazily instantiated SchemaObject; the SchemaObject will call the buildObject
method on the DBObjectBuilder to fill in the rest of the data. The DBObjectBuilder implementation determines how much information is filled in when the SchemaObject is created.
If the DBObjectBuilder implementation does not implement lazy instantiation, createObject
should return a complete SchemaObject. Calling buildObject
on a complete SchemaObject should return immediately.
DBObjectProvider
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BASE_COMPONENT_KEY
Deprecated.
with no replacement. Property building is done using property names.
|
Modifier and Type | Method and Description |
---|---|
void |
buildObject(T object)
Requests that the specified object be completed.
|
void |
buildObjectComponent(T object, java.lang.String key)
Requests that part of the specified object, signifed by the given key, is built.
|
boolean |
canBuildEditableObject()
Tests whether this builder does a complete build of the given object, or whether it is only used to create stub objects.
|
T |
createObject(java.lang.String name, Schema schema, DBObjectID id)
Requests the creation of a new SchemaObject of the type built by this
DBObjectBuilder instance. |
@Deprecated static final java.lang.String BASE_COMPONENT_KEY
T createObject(java.lang.String name, Schema schema, DBObjectID id)
DBObjectBuilder
instance.name
- The name of the new objectschema
- The schema containing the new objectid
- the DBObjectID for the new objectvoid buildObject(T object) throws DBException
object
- The object needing buildingDBException
- if an error occurs trying to build the objectvoid buildObjectComponent(T object, java.lang.String key) throws DBException
object
- the object that needs buildingkey
- the component to build - in the majority of cases this will be a property name.DBException
- if an error occurs trying to build the objectboolean canBuildEditableObject()