You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Rice Yeh <ri...@yahoo.com> on 2003/07/18 11:35:41 UTC

Patch for supporting Interface when traveling instance path of a nested field

Hi Thomas,
  I have wirten a PersistentField interface
implemntatin called "PersistentFieldImp" which suports
interface when traveling an instance path of a nested
field. Its function  is described by the following
javadoc:

-------------------------------------------------------
PersistentFieldImpl implements PersistentField. The
interface PersistentField is used as a wrapper of a
java.lang.
 reflect.Field which is obtained by an instance path
rooted at an object of some class. For example, a
persistent 
 field rooted at class C0 with instance path f1/f2/f3
is defined as the field f3 obtained by the following
pseudo 
 code: 
	Class C0 {
		C1 f1;
	}

	Class C1 {
		C2 f2;
	}

	Class C2 {
		C3 f3;
	}
 Here f1/f2/f3 is the instance path and C1/C2/C3 is
the class path. A good object-oriented programming 
  teaches us that we should use more abstract class
when doing variable declaration. For example, we may
not 
  need to declare f2 as C2 but declare it as I2 when
possible. Hence in many good object modeling, we often

  meet interfaces when traveling an instance path.
However, since no instance can be created with an
abastract 
  class, for an instnace path, it does correspond a
concrete class path. The class path meant is concrete
class 
  path during run time. 
In the above example, if f3 is not declared at all,
that is, f3 is not a declared instance variable of C2,
this 
 persistent field, "f1/f2/f3", is called anonymous.
Anonymous persistent field is used to represent a
field in 
 database model that does not exist in Java class
model, for example the foreign key of one table. 
-------------------------------------------------------

  Attached is the Java file. To support this class, a
attribue called "class-path" must added to
field-descriptor and much existing java files must be
modified. I first attach this file for your opinion.
If   it is ok, I will post the other fields needed.

  From cvs, I know you are refactoring
PerisistentField classes implementation. Indeed, this
implementation does a lot of refactoring of your
previous implementation. The main function of this
class has been tested and applied to a project of
mine. I also try to include anonymous field to this
implementation but it has not been tested.
 

Regards,
Rice

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com