|
Re: OCL with Java importer [message #34357 is a reply to message #34324] |
Fri, 27 July 2007 12:51 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Robert,
EMF does not define any mechanism for attaching OCL constraints to Ecore
models.
MDT OCL does provide support for defining constraints in text documents
using the OMG-standard syntax for context declarations; the developer guide
documentation included in the SDK and the JUnit tests provide examples of
this.
If you are referring to the "Implementing Model Integrity in EMF with OCL"
article's annotations, then you should be able to specify them in your Java
model using EMF's syntax for annotations, e.g.:
/**
* Some class.
*
* @annotation http://www.eclipse.org/ocl/examples/OCL
* someConstraint=self.someOclExpression()
* someOtherConstraint=self.somethingElse()
*/
public interface SomeClass extends EObject {
I'm not exactly sure of the syntax. You can find out by creating an
annotation in an Ecore model and generating the Java interfaces from it.
HTH,
Christian
Robert Enyedi wrote:
> Hi,
>
> I'm investigating the usage of OCL for my models. I maintain my domain
> model as Java code and use the EMF Java importer to obtain the actual
> Ecore model (always generated and not manually edited).
>
> Is there a way to specify OCL constraints directly in the Java
> interfaces? If so, is this documented/exemplified?
>
> Regards,
> Robert
|
|
|
Powered by
FUDForum. Page generated in 0.02629 seconds