Spark,

I don't see many reasons to couple all persistence delegates into a
single class. IMO "one  class to one persistence delegate" model is
obvious and easy to understand. AFAIU RI implements its persistence
delegates in this way. BTW what do you mean by code duplication here?
The behavior of instantiate() method is unique to each PD and all that
we can do is to create a single class with a big big switch that
includes the code from all our PDs. Do we really want this? IMHO it is
not an Object-Oriented way.

Sorry if I misunderstand your idea. Please explain in more details if so.

Thanks,

2007/7/12, Spark Shen <[EMAIL PROTECTED]>:
During developing PersistenceDelegate for java.lang.reflect.Field, I find
code duplication in many primitive type persistence delegate.

There are 8 primitiveType persistenceDelegate:
java_lang_BooleanPersistenceDelegate
java_lang_BytePersistenceDelegate
java_lang_CharacterPersistenceDelegate
java_lang_DoublePersistenceDelegate
java_lang_FloatPersistenceDelegate
java_lang_IntegerPersistenceDelegate
java_lang_LongPersistenceDelegate
java_lang_ShortPersistenceDelegate

Each of the 8 class has two method: instantiate & initialize, and the logic
of the 2 methods are similar.
IMO, we could use one PrimitiveTypePersistenceDelegate instead to reduce
code duplication.
--
Spark Shen
China Software Development Lab, IBM



--
Alexei Zakharov,
Intel ESSD

Reply via email to