I think we're pretty much agreeing with each other now.

Entry of the default value could be quite complex as the type can be
anything. I agree that if the parameter type is not Classifier then
the user would not want a combo for the defaultValue.

Building the dummy element for the parameter is still a point of
confusion for me though

Alexander said:
> Object type = Model.getCoreFactory().buildInterface(templateParameterName);
> Object templateParameter = 
> Model.getCoreFactory().buildTemplateParameter(modelElement, type, null);
> Model.getCoreHelper().addTemplateParameter(modelElement, templateParameter);

The problem is for Classifier we can only build an Interface or a
Class. We can't build a Classifier which is what I think we want here.

Page 45 of the UML2 spec says - "Each parameter is a dummy
ModelElement designated as a placeholder for a real ModelElement to be
substituted during a binding of the template (see Section 4.5.2.8,
“Binding,” on page 32).The real model element must be of the same kind
(or a descendant kind) as the dummy ModelElement."

So in other words by making the dummy element an Interface it will not
be possible to bind a Class to it. Make the dummy element a Class it
will not be possible to bind an Interface to it.

But in java the generic ArrayList<E> can be bound in java code to with
either Class or Interface
     ArrayList<MyClass> = new ArrayList<MyClass>
     ArrayList<MyInterface> = new ArrayList<MyInterface>


I've been looking at other parts of the spec related to this. Page
216/217 show the presentation of the TemplateParameters on a class.
The example given is this is "T, k : Integer"

This is actually two TemplateParameters T and k where for T the type
is ommitted and k is specified as an Integer.

I see in the last paragraph on page 216 - "If the type name is
omitted, the parameter type is assumed to be Classifier.". So in other
words "T, k : Integer" if the same as "T : Classifier, k : Integer".

If the presentation caters for a parameter type of Classifier how can
the model not do so?

I'm struggling to discover how I can do something like the following
line of code as I don't see how else we can achieve what is shown as
being allowable in presentation
Object type = Model.getCoreFactory().buildClassifier(templateParameterName);

Bob.

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=2430147

To unsubscribe from this discussion, e-mail: 
[[email protected]].
To be allowed to post to the list contact the mailing list moderator, email: 
[[email protected]]

Reply via email to