Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tigerstripe-dev] Using annotations....

So, I am trying to make use of the Annotations framework from Tigerstripe...
 
I declared an OclConstraint annotation with 3 attributes (type, description and constraint).
 
I then used the annotation from Tigerstripe in a plugin:
 
#foreach ($entity in $entities)

Here...

$entity.Name | $entity.getAnnotations("tigerstripe")

#set($ocl = $entity.getAnnotations("tigerstripe"))

#foreach ($o in $ocl)

-> $o.content.language

-> $o.content.description

-> $o.content.constraint

#end

This is hardly user friendly. Looking in the implementation of org.eclipse.tigerstripe.annotation.core.Annotation and  org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactComponent

I see the following issues:

1) Annotation just contains the URI of the annotated object and the annotation itself. There is no information about what the annotation is. What I actually want to do is something like:

#set($anno = $entity.getAnnotations("tigerstripe"))

#foreach ($a in $anno)

#if ($a.type == "OclConstraint)

-> $a.content.language

-> $a.content.description

-> $a.content.constraint

#end

#end

2) I also want to get able to directly access an annotation:

#set($ocl = $entity.getAnnotation("tigerstripe","OclConstraint"))

-> $ocl.language

-> $ocl.description

-> $ocl.constraint

--> Should throw an exception if more than one defined...

#set($ocls = $entity.getAnnotations("tigerstripe","OclConstraint"))

These should both return the annotation content, rather than the annotation itself.

Recommended Fix:

1) Add annotationType field to the Annoation object and populate it with the model object name (maybe need more that this? - the annotation URI?)

2) Modify the methods in AbstractComponent as described above.

I will raise bugzillas for this..

Steve


Back to the top