| java.lang.Object org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl
All known Subclasses: org.apache.ojb.broker.RowReaderTestImpl,
RowReaderDefaultImpl | public class RowReaderDefaultImpl implements RowReader(Code) | | Default implementation of the
RowReader interface.
version: $Id: RowReaderDefaultImpl.java,v 1.30.2.11 2005/12/21 22:22:58 tomdz Exp $ |
Method Summary | |
protected Object | buildOrRefreshObject(Map row, ClassDescriptor targetClassDescriptor, Object targetObject) Creates an object instance according to clb, and fills its fileds width data provided by row. | protected String | extractOjbConcreteClass(ClassDescriptor cld, ResultSet rs, Map row) | public ClassDescriptor | getClassDescriptor() | public void | readObjectArrayFrom(ResultSetAndStatement rs_stmt, Map row) materialize a single object, described by cld,
from the first row of the ResultSet rs.
There are two possible strategies:
1. | public Object | readObjectFrom(Map row) materialize a single object, described by cld,
from the first row of the ResultSet rs.
There are two possible strategies:
1. | public void | readPkValuesFrom(ResultSetAndStatement rs_stmt, Map row) | protected void | readValuesFrom(ResultSetAndStatement rs_stmt, Map row, FieldDescriptor[] fields) | public void | refreshObject(Object instance, Map row) | protected ClassDescriptor | selectClassDescriptor(Map row) Check if there is an attribute which tells us which concrete class is to be instantiated. | public void | setClassDescriptor(ClassDescriptor cld) |
readObjectArrayFrom | public void readObjectArrayFrom(ResultSetAndStatement rs_stmt, Map row)(Code) | | materialize a single object, described by cld,
from the first row of the ResultSet rs.
There are two possible strategies:
1. The persistent class defines a public constructor with arguments matching the persistent
primitive attributes of the class. In this case we build an array args of arguments from rs
and call Constructor.newInstance(args) to build an object.
2. The persistent class does not provide such a constructor, but only a public default
constructor. In this case we create an empty instance with Class.newInstance().
This empty instance is then filled by calling Field::set(obj,getObject(matchingColumn))
for each attribute.
The second strategy needs n calls to Field::set() which are much more expensive
than the filling of the args array in the first strategy.
client applications should therefore define adequate constructors to benefit from
performance gain of the first strategy.
throws: PersistenceBrokerException - if there is an error accessing the access layer |
readObjectFrom | public Object readObjectFrom(Map row) throws PersistenceBrokerException(Code) | | materialize a single object, described by cld,
from the first row of the ResultSet rs.
There are two possible strategies:
1. The persistent class defines a public constructor with arguments matching the persistent
primitive attributes of the class. In this case we build an array args of arguments from rs
and call Constructor.newInstance(args) to build an object.
2. The persistent class does not provide such a constructor, but only a public default
constructor. In this case we create an empty instance with Class.newInstance().
This empty instance is then filled by calling Field::set(obj,getObject(matchingColumn))
for each attribute.
The second strategy needs n calls to Field::set() which are much more expensive
than the filling of the args array in the first strategy.
client applications should therefore define adequate constructors to benefit from
performance gain of the first strategy.
MBAIRD: The rowreader is told what type of object to materialize, so we have to trust
it is asked for the right type. It is possible someone marked an extent in the repository,
but not in java, or vice versa and this could cause problems in what is returned.
we *have* to be able to materialize an object from a row that has a objConcreteClass, as we
retrieve ALL rows belonging to that table. The objects using the rowReader will make sure they
know what they are asking for, so we don't have to make sure a descriptor is assignable from the
selectClassDescriptor. This allows us to map both inherited classes and unrelated classes to the
same table.
|
|
|