Re: MORE QUESTIONS: copy of JMI extents

Holger Krug <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi Martin,

many thanks for the time you invested in your answer. It's almost how
I imagined it would be. I really think there should be a clarification
in the spec.
  
On Wed, Aug 07, 2002 at 02:09:03PM +0200, Martin Matula wrote:

> > 3) Was is really a good design decision, to put the factory methods for
> >    StructRef's into the proxies ? At least if StructRef's are deemed to
> >    be compatibel across JMI repositories/implementations I cannot understand
> >    quite well, why it was made so ugly difficult to create them. What would
> >    be the alternatives ?
> 
> That's my question - what would you suggest to make it better?

Structure factories in generated classes
========================================

For the generated classes/interfaces I would provide an interface
MyStruct and a class MyStructDefault implementing the interface. The
class has its constructor(s) as public factories.  No implementor
should have problems with this. It would be possible to restructure
values of MyStruct when given in attribute setters as needed by the
implementation. The implementation type of the values returned by
attribute getters could be specific to the implementation.

Structure factories in reflective classes
=========================================

For the reflective classes/interfaces I would allow to provide
instances of Map (or RefStructMap, a new class similar to Map, which
which enforces the keys to be String's resp. StructureField's) and
allow to set a Map value where a structure value is required.
Alternatively one could think about Object[], what would be more
performant.

Not related by also a result of my experiences with generic JMI
coding:

Not allowing class type inside datatypes
========================================

In MOF I would not allow class types inside collection or structure
types at all. It's semantically strange, probably never used and
creates only problems. If *really* necessary as a replacement one
could introduce a reference type, where values of references types are
*externalizable* references to instances.

The JMI spec would contain a class or interface Reference which
extends Serializable and describe how the referred instance can be
accessed given a reference value. This behaviour could even be fully
or partially implementation dependent.


-- 
Holger Krug
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.