S
Stefan Siegl
Hi,
I have a J2EE component that provides access to a repository in which a
model for a customer relationship management (CRM) system is kept. The
(M1 layer) model of the CRM can be changed during runtime using an
provided API. The component additionally stores data according to the
current model. In order to access this data (M0 layer) an API needs to
be provided that is not dependent on the current model (because this
model can change all the time and therefore the access interface would
change as well).
What we know about the model is that the top most classes are always the
same abstract classes with the CRMElement class being the super class of
the complete hierarchy.
What i basically wanted to do is create a generic API to access this
data without using the concrete subclasses of the model that may be
created and changed during runtime.
Possible code example:
----------------------
// creation of a specific subtype of an abstract class called "Human"
CRMElement e = DMA.create(“Human”);
e = DMA.setAttribute(e, "name", "some name");
e = DMA.setAttribute(e, "age", new Integer(25));
// retrieving information
CRMElement e = DMA.findById(“someId”);
What i do not know for sure is if the reflection mechanism works when
retrieving the data. I mean the component accessing my API will get an
instance of the class CRMElement which may be in fact an instance of the
class "Human".
Is it possible for the other component to query all possible methods
(even those of the human) althought the component do not have the .class
file of "Human"?
Thanks for your time,
Stefan
I have a J2EE component that provides access to a repository in which a
model for a customer relationship management (CRM) system is kept. The
(M1 layer) model of the CRM can be changed during runtime using an
provided API. The component additionally stores data according to the
current model. In order to access this data (M0 layer) an API needs to
be provided that is not dependent on the current model (because this
model can change all the time and therefore the access interface would
change as well).
What we know about the model is that the top most classes are always the
same abstract classes with the CRMElement class being the super class of
the complete hierarchy.
What i basically wanted to do is create a generic API to access this
data without using the concrete subclasses of the model that may be
created and changed during runtime.
Possible code example:
----------------------
// creation of a specific subtype of an abstract class called "Human"
CRMElement e = DMA.create(“Human”);
e = DMA.setAttribute(e, "name", "some name");
e = DMA.setAttribute(e, "age", new Integer(25));
// retrieving information
CRMElement e = DMA.findById(“someId”);
What i do not know for sure is if the reflection mechanism works when
retrieving the data. I mean the component accessing my API will get an
instance of the class CRMElement which may be in fact an instance of the
class "Human".
Is it possible for the other component to query all possible methods
(even those of the human) althought the component do not have the .class
file of "Human"?
Thanks for your time,
Stefan