|
Re: Generating methods for multiple constraints [message #422327 is a reply to message #422326] |
Sat, 30 August 2008 15:59 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, AJ,
To specify multiple constraints, you should define only one annotation
key with all of the constranint, thus:
EAnnotation http://www.eclipse.org/emf/2002/Ecore
constraints -> DurationNonEmpty ClaimsConflict
The package-impl code would end up looking like:
protected void createEcoreAnnotations() {
String source =
"http://www.eclipse.org/emf/2002/Ecore";
addAnnotation
(activityDefEClass,
source,
new String[] {
"constraints", "DurationNonempty ClaimsConflict"
});
}
HTH,
Christian
AJ wrote:
> Hi,
>
> I've created a constraint for a single model element via EAnnotation ->
> Detail Entry and EMF generates the validation method for it (i.e. the
> validateActivityDef_DurationNonempty() method).
>
> Now, if I add a second constraint, then none method for these
> constraints are generated in the XYZValidator class. Does it mean that
> I can only add one constraint per model element?
>
> /**
> * Initializes the annotations for
> <b>http://www.eclipse.org/emf/2002/Ecore</b>.
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> protected void createEcoreAnnotations() {
> String source =
> "http://www.eclipse.org/emf/2002/Ecore";
> addAnnotation
> (activityDefEClass,
> source,
> new String[] {
> "constraint_1", "DurationNonempty",
> "constraint_2", "ClaimsConflict"
> }); }
|
|
|
Powered by
FUDForum. Page generated in 0.03703 seconds