tomdz 2005/04/11 11:39:02
Modified: src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
QueryReferenceBroker.java
src/java/org/apache/ojb/broker/accesslayer Tag:
OJB_1_0_RELEASE CollectionPrefetcher.java
Log:
Added support for using collections classes that implement
ManageableCollection directly as the field type without having to specify
collection-class
Revision Changes Path
No revision
No revision
1.17.2.8 +5 -1
db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
Index: QueryReferenceBroker.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java,v
retrieving revision 1.17.2.7
retrieving revision 1.17.2.8
diff -u -r1.17.2.7 -r1.17.2.8
--- QueryReferenceBroker.java 11 Apr 2005 16:21:01 -0000 1.17.2.7
+++ QueryReferenceBroker.java 11 Apr 2005 18:39:02 -0000 1.17.2.8
@@ -298,6 +298,10 @@
{
collType = cds.isMtoNRelation() ? ManageableHashSet.class :
RemovalAwareSet.class;
}
+ else if (ManageableCollection.class.isAssignableFrom(fieldType))
+ {
+ collType = fieldType;
+ }
else
{
throw new MetadataException("Cannot determine a default
collection type for collection "+cds.getAttributeName()+" in type
"+cds.getClassDescriptor().getClassNameOfObject());
No revision
No revision
1.29.2.3 +13 -2
db-ojb/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
Index: CollectionPrefetcher.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java,v
retrieving revision 1.29.2.2
retrieving revision 1.29.2.3
diff -u -r1.29.2.2 -r1.29.2.3
--- CollectionPrefetcher.java 11 Apr 2005 16:21:01 -0000 1.29.2.2
+++ CollectionPrefetcher.java 11 Apr 2005 18:39:02 -0000 1.29.2.3
@@ -217,7 +217,18 @@
if (collectionClass == null)
{
- if (fieldType.isAssignableFrom(RemovalAwareCollection.class))
+ if (ManageableCollection.class.isAssignableFrom(fieldType))
+ {
+ try
+ {
+ col = (ManageableCollection)fieldType.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new OJBRuntimeException("Cannot instantiate the
default collection type "+fieldType.getName()+" of collection
"+desc.getAttributeName()+" in type
"+desc.getClassDescriptor().getClassNameOfObject());
+ }
+ }
+ else if
(fieldType.isAssignableFrom(RemovalAwareCollection.class))
{
col = new RemovalAwareCollection();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]