MoDisco for annotation processing [message #639808] |
Wed, 17 November 2010 21:32 |
Laurent Legrand Messages: 3 Registered: November 2010 Location: France |
Junior Member |
|
|
Hello,
I'm discovering MoDisco and I'm wondering if MoDisco could be used to do some Java annotation validation.
The idea is to first declare a Model Facet Set on top of the Java metamodel containing:
* A Facet will correspond to a Java annotation. For instance, for the Java annotation MyAnnotation, there will be a corresponding MyAnnotationFacet
* A Facet will extends EClass from the Java metamodel depending on the java.lang.annotation.Target specified on the Java annotation declaration. For instance, if MyAnnotation has Method as target, MyAnnotationFacet will extend MethodDeclaration.
* A FacetStructuralFeature will be declared for each property defined in the Java annotation
* ...
Once done, If I'm right, the Model Browser will highlight in a Java model the elements annotated with MyAnnotation thanks to MyAnnotationFacet.
But could I go a step further and use the faceted model (the virtual one on top of the Java model) for annotation validation in a project? Could I use an EMF based constraint language (OCL, Epsilon) to check rules against instances of classes defined in the Facet Set (I mean define rules using MyAnnotationFacet) ?
I hope my question makes sense.
Regards,
Laurent
|
|
|
Re: MoDisco for annotation processing [message #639884 is a reply to message #639808] |
Thu, 18 November 2010 09:22 |
Gregoire Dupe Messages: 75 Registered: September 2009 Location: France |
Member |
|
|
Laurent Legrand wrote on Wed, 17 November 2010 16:32 | Hello,
I'm discovering MoDisco and I'm wondering if MoDisco could be used to do some Java annotation validation.
The idea is to first declare a Model Facet Set on top of the Java metamodel containing:
* A Facet will correspond to a Java annotation. For instance, for the Java annotation MyAnnotation, there will be a corresponding MyAnnotationFacet
* A Facet will extends EClass from the Java metamodel depending on the java.lang.annotation.Target specified on the Java annotation declaration. For instance, if MyAnnotation has Method as target, MyAnnotationFacet will extend MethodDeclaration.
* A FacetStructuralFeature will be declared for each property defined in the Java annotation
* ...
|
This looks good.
Laurent Legrand wrote on Wed, 17 November 2010 16:32 |
But could I go a step further and use the faceted model (the virtual one on top of the Java model) for annotation validation in a project? Could I use an EMF based constraint language (OCL, Epsilon) to check rules against instances of classes defined in the Facet Set (I mean define rules using MyAnnotationFacet) ?
|
The only way to use the facets in a program is the MoDisco's Java API. (cf. http://wiki.eclipse.org/MoDisco/Components/FacetManager/Docu mentation/0.8#How_to_programmatically_use_the_MoDisco_facet_ set_catalog)
We plan to provide a mechanism to be able to use any languages next year (Juin 2012).
Regards,
Gregoire Dupe
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05854 seconds