Debian Codegraph @

plugins/org.eclipse.emf.codegen.ecore/templates/model/ValidatorClass.javajet

raw
1 <%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.emf.codegen.util.CodeGenUtil org.eclipse.emf.codegen.ecore.genmodel.util.GenModelUtil" class="ValidatorClass"%>
2 <%
3 /**
4 * Copyright (c) 2002-2013 IBM Corporation and others.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v2.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v20.html
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 */
13 %>
14 <%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();%>
15 <%final boolean isJDK50 = genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50;%>
16 <%final String singleWildcard = genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50 ? "<?>" : "";%>
17 <%@ include file="../Header.javajetinc"%>
18 package <%=genPackage.getUtilitiesPackageName()%>;
19
20 <%genModel.addImport("java.util.Map");%>
21 <%final String _Map = genModel.useGenerics() ? "Map<" + genModel.getImportedName("java.lang.Object") + ", " + genModel.getImportedName("java.lang.Object") + ">" : "Map";%>
22 <%final String objectArgument = genModel.useGenerics() ? "<" + genModel.getImportedName("java.lang.Object") + ">" : "";%>
23 <%genModel.addImport("org.eclipse.emf.common.util.DiagnosticChain");%>
24 <%genModel.addImport("org.eclipse.emf.ecore.EPackage");%>
25 <%if (!genPackage.hasJavaLangConflict() && !genPackage.getUtilitiesPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*");%>
26 <%genModel.markImportLocation(stringBuffer);%>
27 <%genModel.addPseudoImport("org.eclipse.emf.ecore.EValidator.Descriptor");%>
28 <%genModel.addPseudoImport("org.eclipse.emf.ecore.EValidator.Registry");%>
29 <%genModel.addPseudoImport("org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider");%>
30 <%genModel.addPseudoImport("org.eclipse.emf.ecore.EValidator.PatternMatcher");%>
31
32 /**
33 * <!-- begin-user-doc -->
34 * The <b>Validator</b> for the model.
35 * <!-- end-user-doc -->
36 * @see <%=genPackage.getQualifiedPackageInterfaceName()%>
37 <%if (genPackage.hasAPITags()) {%>
38 * <%=genPackage.getAPITags(genModel.getIndentation(stringBuffer))%>
39 <%}%>
40 * @generated
41 */
42 <%if (isJDK50 && genPackage.hasAPIDeprecatedTag()) {%>
43 @Deprecated
44 <%} else if (isJDK50 && GenModelUtil.hasAPIDeprecatedTag(genPackage.getGenClassifiers())) {%>
45 @SuppressWarnings("deprecation")
46 <%}%>
47 public class <%=genPackage.getValidatorClassName()%> extends <%=genModel.getImportedName("org.eclipse.emf.ecore.util.EObjectValidator")%>
48 {
49 <%if (genModel.hasCopyrightField()) {%>
50 /**
51 * <!-- begin-user-doc -->
52 * <!-- end-user-doc -->
53 * @generated
54 */
55 public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%>
56
57 <%}%>
58 /**
59 * The cached model package
60 * <!-- begin-user-doc -->
61 * <!-- end-user-doc -->
62 * @generated
63 */
64 public static final <%=genPackage.getValidatorClassName()%> INSTANCE = new <%=genPackage.getValidatorClassName()%>();
65
66 /**
67 * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
68 * <!-- begin-user-doc -->
69 * <!-- end-user-doc -->
70 * @see org.eclipse.emf.common.util.Diagnostic#getSource()
71 * @see org.eclipse.emf.common.util.Diagnostic#getCode()
72 * @generated
73 */
74 public static final String DIAGNOSTIC_SOURCE = "<%=genPackage.getInterfacePackageName()%>";<%=genModel.getNonNLS()%>
75
76 <%int count = 0; for (GenClass genClass : genPackage.getGenClasses()) {%>
77 <%for (GenOperation genOperation : genClass.getInvariantOperations()) {%>
78 /**
79 * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint '<%=genOperation.getFormattedName()%>' of '<%=genClass.getFormattedName()%>'.
80 * <!-- begin-user-doc -->
81 * <!-- end-user-doc -->
82 * @generated
83 */
84 public static final int <%=genClass.getOperationID(genOperation)%> = <%=++count%>;
85
86 <%}}%>
87 /**
88 * A constant with a fixed name that can be used as the base value for additional hand written constants.
89 * <!-- begin-user-doc -->
90 * <!-- end-user-doc -->
91 * @generated
92 */
93 private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = <%=count%>;
94
95 /**
96 * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class.
97 * <!-- begin-user-doc -->
98 * <!-- end-user-doc -->
99 * @generated
100 */
101 protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
102
103 <%for (GenPackage baseGenPackage : genPackage.getAllValidatorBaseGenPackages()) {%>
104 /**
105 * The cached base package validator.
106 * <!-- begin-user-doc -->
107 * <!-- end-user-doc -->
108 * @generated
109 */
110 protected <%=baseGenPackage.getImportedValidatorClassName()%> <%=genPackage.getValidatorPackageUniqueSafeName(baseGenPackage)%>Validator;
111
112 <%}%>
113 <%if (genPackage.hasInvariantExpressions()) {%>
114 /**
115 * Delegates evaluation of the given invariant expression against the object in the given context.
116 * <!-- begin-user-doc -->
117 * <!-- end-user-doc -->
118 * @generated
119 */
120 public static boolean validate(<%=genModel.getImportedName("org.eclipse.emf.ecore.EClass")%> eClass, <%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%> eObject, DiagnosticChain diagnostics, <%=_Map%> context, <%=genModel.getImportedName("java.lang.String")%> validationDelegate, <%=genModel.getImportedName("org.eclipse.emf.ecore.EOperation")%> invariant, <%=genModel.getImportedName("java.lang.String")%> expression, int severity, <%=genModel.getImportedName("java.lang.String")%> source, int code)
121 {
122 return <%=genModel.getImportedName("org.eclipse.emf.ecore.util.EObjectValidator")%>.validate(eClass, eObject, diagnostics, context, validationDelegate, invariant, expression, severity, source, code);
123 }
124
125 <%}%>
126 /**
127 * Creates an instance of the switch.
128 * <!-- begin-user-doc -->
129 * <!-- end-user-doc -->
130 * @generated
131 */
132 public <%=genPackage.getValidatorClassName()%>()
133 {
134 super();
135 <%for (GenPackage baseGenPackage : genPackage.getAllValidatorBaseGenPackages()) {%>
136 <%=genPackage.getValidatorPackageUniqueSafeName(baseGenPackage)%>Validator = <%=baseGenPackage.getImportedValidatorClassName()%>.INSTANCE;
137 <%}%>
138 }
139
140 /**
141 * Returns the package of this validator switch.
142 * <!-- begin-user-doc -->
143 * <!-- end-user-doc -->
144 * @generated
145 */
146 <%if (genModel.useClassOverrideAnnotation()) {%>
147 @Override
148 <%}%>
149 protected EPackage getEPackage()
150 {
151 return <%=genPackage.getImportedPackageInterfaceName()%>.eINSTANCE;
152 }
153
154 /**
155 * Calls <code>validateXXX</code> for the corresponding classifier of the model.
156 * <!-- begin-user-doc -->
157 * <!-- end-user-doc -->
158 * @generated
159 */
160 <%if (genModel.useClassOverrideAnnotation()) {%>
161 @Override
162 <%}%>
163 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
164 <%if (genClassifier.isUncheckedCast()) {%>
165 @SuppressWarnings("unchecked")
166 <%break; }%>
167 <%}%>
168 protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, <%=_Map%> context)
169 {
170 switch (classifierID)
171 {
172 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
173 case <%=genPackage.getImportedPackageInterfaceName()%>.<%=genPackage.getClassifierID(genClassifier)%>:
174 <%if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;%>
175 <%if (genDataType.isPrimitiveType()) {%>
176 <%if (genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>
177 return validate<%=genDataType.getName()%>(((<%=genDataType.getObjectInstanceClassName()%>)value).<%=genDataType.getPrimitiveValueFunction()%>(), diagnostics, context);
178 <%} else {%>
179 return validate<%=genDataType.getName()%>((<%=genDataType.getObjectInstanceClassName()%>)value, diagnostics, context);
180 <%}%>
181 <%} else if (genDataType.isObjectType()) {%>
182 return validate<%=genDataType.getName()%>(value, diagnostics, context);
183 <%} else {%>
184 return validate<%=genDataType.getName()%>((<%=genDataType.getObjectType().getImportedWildcardInstanceClassName()%>)value, diagnostics, context);
185 <%}%>
186 <%} else { GenClass genClass = (GenClass)genClassifier;%>
187 return validate<%=genClass.getName()%>((<%=genClass.getImportedWildcardInstanceClassName()%>)value, diagnostics, context);
188 <%}%>
189 <%}%>
190 default:
191 return true;
192 }
193 }
194
195 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {String result = "result".equals(genClassifier.getSafeUncapName()) ? "theResult" : "result"; String diagnostics = "diagnostics".equals(genClassifier.getSafeUncapName()) ? "theDiagnostics" : "diagnostics"; String item = "item".equals(genClassifier.getSafeUncapName()) ? "theItem" : "item"; String context = "context".equals(genClassifier.getSafeUncapName()) ? "theContext" : "context";%>
196 /**
197 * <!-- begin-user-doc -->
198 * <!-- end-user-doc -->
199 <%if (genClassifier.hasAPITags()) {%>
200 * <%=genClassifier.getAPITags(genModel.getIndentation(stringBuffer))%>
201 <%}%>
202 * @generated
203 */
204 <%if (isJDK50 && genClassifier.hasAPIDeprecatedTag()) {%>
205 @Deprecated
206 <%}%>
207 public boolean validate<%=genClassifier.getName()%>(<%=genClassifier.getImportedWildcardInstanceClassName()%> <%=genClassifier.getSafeUncapName()%>, DiagnosticChain <%=diagnostics%>, <%=_Map%> <%=context%>)
208 {
209 <%if (genClassifier.getAllGenConstraints().isEmpty()) {%>
210 return true;
211 <%} else if (genClassifier.hasOnlyDefaultConstraints()) {%>
212 return validate_EveryDefaultConstraint(<%if (!((GenClass)genClassifier).isEObjectExtension()){%>(<%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%>)<%}%><%=genClassifier.getSafeUncapName()%>, <%=diagnostics%>, <%=context%>);
213 <%} else { boolean first = true;%>
214 <%for (String constraint : genClassifier.getAllGenConstraints()) {GenClassifier constraintImplementor = genClassifier.getConstraintImplementor(constraint);
215 String delegate = constraintImplementor == null || constraintImplementor.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(constraintImplementor.getGenPackage()) + "Validator.";
216 String cast = constraintImplementor == null && genClassifier instanceof GenClass && !((GenClass)genClassifier).isEObjectExtension() ? "(" + genModel.getImportedName("org.eclipse.emf.ecore.EObject") + ")" : "";
217 String accessor = constraintImplementor != null && genClassifier instanceof GenDataType && !((GenDataType)genClassifier).isPrimitiveType() && ((GenDataType)constraintImplementor).isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50 ? "." + ((GenDataType)constraintImplementor).getPrimitiveValueFunction() + "()" : "";%>
218 <%if ("NoCircularContainment".equals(constraint)) {%>
219 if (!validate_NoCircularContainment(<%if (!((GenClass)genClassifier).isEObjectExtension()){%>(<%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%>)<%}%><%=genClassifier.getSafeUncapName()%>, <%=diagnostics%>, <%=context%>)) return false;
220 <%} else if (first) { first = false;%>
221 boolean <%=result%> = <%=delegate%>validate<%=constraintImplementor == null ? "" : constraintImplementor.getName()%>_<%=constraint%>(<%=cast%><%=genClassifier.getSafeUncapName()%><%=accessor%>, <%=diagnostics%>, <%=context%>);
222 <%} else {%>
223 if (<%=result%> || <%=diagnostics%> != null) <%=result%> &= <%=delegate%>validate<%=constraintImplementor == null ? "" : constraintImplementor.getName()%>_<%=constraint%>(<%=cast%><%=genClassifier.getSafeUncapName()%><%=accessor%>, <%=diagnostics%>, <%=context%>);
224 <%}%>
225 <%}%>
226 return <%=result%>;
227 <%}%>
228 }
229
230 <%for (String constraint : genClassifier.getGenConstraints())
231 {GenClassifier constraintDelegate = genClassifier.getConstraintDelegate(constraint);
232 String constant = genClassifier.getClassifierID() + "__" + CodeGenUtil.format(constraint, '_', null, false, false).toUpperCase(genClassifier.getGenModel().getLocale());
233 String delegate = constraintDelegate == null || constraintDelegate.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(constraintDelegate.getGenPackage()) + "Validator.";
234 String cast = constraintDelegate == null && genClassifier instanceof GenClass && !((GenClass)genClassifier).isEObjectExtension() ? "(" + genModel.getImportedName("org.eclipse.emf.ecore.EObject") + ")" : "";
235 String accessor = constraintDelegate != null && genClassifier instanceof GenDataType && !((GenDataType)genClassifier).isPrimitiveType() && ((GenDataType)constraintDelegate).isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50 ? "." + ((GenDataType)constraintDelegate).getPrimitiveValueFunction() + "()" : "";%>
236 <%if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;%>
237 <%if (constraint.equals("Min") && genDataType.getMinLiteral() != null) {%>
238 /**
239 * <!-- begin-user-doc -->
240 * <!-- end-user-doc -->
241 * @generated
242 * @see #validate<%=genDataType.getName()%>_<%=constraint%>
243 */
244 public static final <%=genDataType.getImportedInstanceClassName()%> <%=constant%>__VALUE = <%=genDataType.getStaticValue(genDataType.getMinLiteral())%>;
245
246 <%} else if (constraint.equals("Max") && genDataType.getMaxLiteral() != null) {%>
247 /**
248 * <!-- begin-user-doc -->
249 * <!-- end-user-doc -->
250 * @generated
251 * @see #validate<%=genDataType.getName()%>_<%=constraint%>
252 */
253 public static final <%=genDataType.getImportedInstanceClassName()%> <%=constant%>__VALUE = <%=genDataType.getStaticValue(genDataType.getMaxLiteral())%>;
254
255 <%} else if (constraint.equals("TotalDigits") && genDataType.getTotalDigits() != -1 && !"java.math.BigDecimal".equals(genDataType.getQualifiedInstanceClassName())) { String value = "1"; for (int digitCount = genDataType.getTotalDigits(); digitCount > 0; --digitCount) value += "0"; %>
256 /**
257 * <!-- begin-user-doc -->
258 * <!-- end-user-doc -->
259 * @generated
260 * @see #validate<%=genDataType.getName()%>_<%=constraint%>
261 */
262 public static final <%=genDataType.getImportedInstanceClassName()%> <%=constant%>__UPPER_BOUND = <%=genDataType.getStaticValue(value)%>;
263
264 /**
265 * <!-- begin-user-doc -->
266 * <!-- end-user-doc -->
267 * @generated
268 * @see #validate<%=genDataType.getName()%>_<%=constraint%>
269 */
270 public static final <%=genDataType.getImportedInstanceClassName()%> <%=constant%>__LOWER_BOUND = <%=genDataType.getStaticValue("-" + value)%>;
271
272 <%} else if (constraint.equals("Pattern") && !genDataType.getPatterns().isEmpty()) {%>
273 /**
274 * <!-- begin-user-doc -->
275 * <!-- end-user-doc -->
276 * @generated
277 * @see #validate<%=genDataType.getName()%>_<%=constraint%>
278 */
279 public static final PatternMatcher [][] <%=constant%>__VALUES =
280 new PatternMatcher [][]
281 {
282 <%for (Iterator<List<String>> k = genDataType.getPatterns().iterator(); k.hasNext(); ) { List<String> patternList = k.next();%>
283 new PatternMatcher []
284 {
285 <%for (Iterator<String> p = patternList.iterator(); p.hasNext(); ) { String pattern = p.next();%>
286 <%=genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil")%>.createPatternMatcher(<%=pattern%>)<%=p.hasNext() ? "," : ""%>
287 <%}%>
288 }<%=k.hasNext() ? "," : ""%>
289 <%}%>
290 };
291
292 <%} else if (constraint.equals("Enumeration") && !genDataType.getEnumerationLiterals().isEmpty()) {%>
293 /**
294 * <!-- begin-user-doc -->
295 * <!-- end-user-doc -->
296 * @generated
297 * @see #validate<%=genDataType.getName()%>_<%=constraint%>
298 */
299 <%if (genDataType.isUncheckedCast()) {%>
300 @SuppressWarnings("unchecked")
301 <%}%>
302 public static final <%=genModel.getImportedName("java.util.Collection")%><%=objectArgument%> <%=constant%>__VALUES =
303 wrapEnumerationValues
304 (new Object[]
305 {
306 <%for (Iterator<String> k = genDataType.getEnumerationLiterals().iterator(); k.hasNext(); ) { String literal = k.next();%>
307 <%if (genDataType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>new <%=genDataType.getObjectInstanceClassName()%>(<%}%><%=genDataType.getStaticValue(literal, false)%><%if (genDataType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>)<%}%><%=k.hasNext() ? "," : ""%>
308 <%}%>
309 });
310
311 <%}%>
312 <%}%>
313 <%if (genClassifier.hasConstraintExpression(constraint)) {%>
314 /**
315 * The cached validation expression for the <%=constraint%> constraint of '<em><%=genClassifier.getFormattedName()%></em>'.
316 * <!-- begin-user-doc -->
317 * <!-- end-user-doc -->
318 * @generated
319 */
320 protected static final <%=genModel.getImportedName("java.lang.String")%> <%=genClassifier.getClassifierID()%>__<%=CodeGenUtil.upperName(constraint)%>__EEXPRESSION = "<%=genClassifier.getConstraintExpression(constraint, "\t\t")%>";<%=genModel.getNonNLS()%>
321
322 <%}%>
323 /**
324 * Validates the <%=constraint%> constraint of '<em><%=genClassifier.getFormattedName()%></em>'.
325 * <!-- begin-user-doc -->
326 * <!-- end-user-doc -->
327 * @generated
328 */
329 public boolean validate<%=genClassifier.getName()%>_<%=constraint%>(<%=genClassifier.getImportedWildcardInstanceClassName()%> <%=genClassifier.getSafeUncapName()%>, DiagnosticChain <%=diagnostics%>, <%=_Map%> <%=context%>)
330 {
331 <%if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;%>
332 <%if (constraint.equals("ItemType") && genDataType.getItemType() != null) { GenDataType itemType = genDataType.getItemType(); String itemDelegate = itemType.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(itemType.getGenPackage()) + "Validator.";%>
333 boolean <%=result%> = true;
334 for (<%=genModel.getImportedName("java.util.Iterator")%><%=singleWildcard%> i = <%=genClassifier.getSafeUncapName()%>.iterator(); i.hasNext() && (result || diagnostics != null); )
335 {
336 Object item = i.next();
337 <%if (itemType.getGenPackage().hasConstraints()) {%>
338 if (<%=itemType.getQualifiedClassifierAccessor()%>.isInstance(item))
339 {
340 result &= <%=itemDelegate%>validate<%=itemType.getName()%>(<%if (itemType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>(<%}%><%if (!itemType.isObjectType()) {%>(<%=itemType.getObjectInstanceClassName()%>)<%}%><%=item%><%if (itemType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>).<%=itemType.getPrimitiveValueFunction()%>()<%}%>, <%=diagnostics%>, <%=context%>);
341 }
342 else
343 <%} else {%>
344 if (!<%=itemType.getQualifiedClassifierAccessor()%>.isInstance(item))
345 <%}%>
346 {
347 result = false;
348 reportDataValueTypeViolation(<%=itemType.getQualifiedClassifierAccessor()%>, item, <%=diagnostics%>, <%=context%>);
349 }
350 }
351 return result;
352 <%} else if (constraint.equals("MemberTypes") && !genDataType.getMemberTypes().isEmpty()) {%>
353 if (diagnostics != null)
354 {
355 <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")%> tempDiagnostics = new BasicDiagnostic();
356 <%for (ListIterator<GenDataType> k = genDataType.getMemberTypes().listIterator(); k.hasNext(); ) { GenDataType memberType = k.next(); String memberDelegate = memberType.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(memberType.getGenPackage()) + "Validator.";%>
357 <%if (genDataType.isPrimitiveType()) {%>
358 if (<%=memberDelegate%>validate<%=memberType.getName()%>(<%=genClassifier.getSafeUncapName()%>, tempDiagnostics, <%=context%>)) return true;
359 <%} else {%>
360 if (<%=memberType.getQualifiedClassifierAccessor()%>.isInstance(<%=genClassifier.getSafeUncapName()%>))
361 {
362 <%if (memberType.getGenPackage().hasConstraints()) {%>if (<%=memberDelegate%>validate<%=memberType.getName()%>(<%if (memberType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>(<%}%><%if (!memberType.isObjectType() && !memberType.getQualifiedInstanceClassName().equals(genDataType.getQualifiedInstanceClassName())) {%>(<%=memberType.getImportedWildcardObjectInstanceClassName()%>)<%}%><%=genClassifier.getSafeUncapName()%><%if (memberType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>).<%=memberType.getPrimitiveValueFunction()%>()<%}%>, tempDiagnostics, <%=context%>)) <%}%>return true;
363 }
364 <%}%>
365 <%}%>
366 <%if (genModel.useGenerics()) {%>
367 for (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%> diagnostic : tempDiagnostics.getChildren())
368 {
369 diagnostics.add(diagnostic);
370 }
371 <%} else {%>
372 <%=genModel.getImportedName("java.util.List")%> children = tempDiagnostics.getChildren();
373 for (int i = 0; i < children.size(); i++)
374 {
375 diagnostics.add((<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>)children.get(i));
376 }
377 <%}%>
378 }
379 else
380 {
381 <%for (ListIterator<GenDataType> k = genDataType.getMemberTypes().listIterator(); k.hasNext(); ) { GenDataType memberType = k.next(); String memberDelegate = memberType.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(memberType.getGenPackage()) + "Validator.";%>
382 <%if (genDataType.isPrimitiveType()) {%>
383 if (<%=memberDelegate%>validate<%=memberType.getName()%>(<%=genClassifier.getSafeUncapName()%>, null, <%=context%>)) return true;
384 <%} else {%>
385 if (<%=memberType.getQualifiedClassifierAccessor()%>.isInstance(<%=genClassifier.getSafeUncapName()%>))
386 {
387 <%if (memberType.getGenPackage().hasConstraints()) {%>if (<%=memberDelegate%>validate<%=memberType.getName()%>(<%if (memberType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>(<%}%><%if (!memberType.isObjectType() && !memberType.getQualifiedInstanceClassName().equals(genDataType.getQualifiedInstanceClassName())) {%>(<%=memberType.getImportedWildcardObjectInstanceClassName()%>)<%}%><%=genClassifier.getSafeUncapName()%><%if (memberType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>).<%=memberType.getPrimitiveValueFunction()%>()<%}%>, null, <%=context%>)) <%}%>return true;
388 }
389 <%}%>
390 <%}%>
391 }
392 return false;
393 <%} else if (constraint.equals("Pattern") && !genDataType.getPatterns().isEmpty()) {%>
394 return validatePattern(<%=genDataType.getQualifiedClassifierAccessor()%>, <%if (genDataType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>new <%=genDataType.getObjectInstanceClassName()%>(<%}%><%=genDataType.getSafeUncapName()%><%if (genDataType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>)<%}%>, <%=constant%>__VALUES, <%=diagnostics%>, <%=context%>);
395 <%} else if (constraint.equals("Enumeration") && !genDataType.getEnumerationLiterals().isEmpty()) { String variable = genDataType.getSafeUncapName();%>
396 <%if (genDataType.isPrimitiveType() && genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) { variable = variable + "Object";%>
397 <%=genDataType.getObjectInstanceClassName()%> <%=variable%> = new <%=genDataType.getObjectInstanceClassName()%>(<%=genDataType.getSafeUncapName()%>);
398 <%}%>
399 boolean <%=result%> = <%=constant%>__VALUES.contains(<%=variable%>);
400 if (!<%=result%> && <%=diagnostics%> != null)
401 reportEnumerationViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=variable%>, <%=constant%>__VALUES, <%=diagnostics%>, <%=context%>);
402 return <%=result%>;
403 <%} else if (constraint.equals("Min") && genDataType.getMinLiteral() != null) {%>
404 <%if (genDataType.isPrimitiveType()) {%>
405 boolean <%=result%> = <%=genDataType.getSafeUncapName()%> <%=genDataType.isMinInclusive() ? ">=" : ">"%> <%=constant%>__VALUE;
406 if (!<%=result%> && <%=diagnostics%> != null)
407 <%if (genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>
408 reportMinViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, new <%=genDataType.getObjectInstanceClassName()%>(<%=genDataType.getSafeUncapName()%>), new <%=genDataType.getObjectInstanceClassName()%>(<%=constant%>__VALUE), <%=genDataType.isMinInclusive() ? "true" : "false"%>, <%=diagnostics%>, <%=context%>);
409 <%} else {%>
410 reportMinViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, <%=constant%>__VALUE, <%=genDataType.isMinInclusive() ? "true" : "false"%>, <%=diagnostics%>, <%=context%>);
411 <%}%>
412 return <%=result%>;
413 <%} else { String comparison = "comparison".equals(genClassifier.getSafeUncapName()) ? "theComparison" : "comparison";%>
414 <%if (genDataType.isXMLCalendar()) {%>
415 int <%=comparison%> = <%=genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil")%>.compareCalendar(<%=genDataType.getSafeUncapName()%>, <%=constant%>__VALUE);
416 boolean <%=result%> = <%if (genDataType.isMinInclusive()) {%><%=comparison%> == 0 || <%}%><%=comparison%> == 1;
417 <%} else if (genDataType.isXMLDuration()) {%>
418 int <%=comparison%> = <%=genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil")%>.compareDuration(<%=genDataType.getSafeUncapName()%>, <%=constant%>__VALUE);
419 boolean <%=result%> = <%if (genDataType.isMinInclusive()) {%><%=comparison%> == 0 || <%}%><%=comparison%> == 1;
420 <%} else {%>
421 boolean <%=result%> = <%=genDataType.getSafeUncapName()%>.compareTo(<%=constant%>__VALUE) <%=genDataType.isMinInclusive() ? ">=" : ">"%> 0;
422 <%}%>
423 if (!<%=result%> && <%=diagnostics%> != null)
424 reportMinViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, <%=constant%>__VALUE, <%=genDataType.isMinInclusive() ? "true" : "false"%>, <%=diagnostics%>, <%=context%>);
425 return <%=result%>;
426 <%}%>
427 <%} else if (constraint.equals("Max") && genDataType.getMaxLiteral() != null) {%>
428 <%if (genDataType.isPrimitiveType()) {%>
429 boolean <%=result%> = <%=genDataType.getSafeUncapName()%> <%=genDataType.isMaxInclusive() ? "<=" : "<"%> <%=constant%>__VALUE;
430 if (!<%=result%> && <%=diagnostics%> != null)
431 <%if (genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>
432 reportMaxViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, new <%=genDataType.getObjectInstanceClassName()%>(<%=genDataType.getSafeUncapName()%>), new <%=genDataType.getObjectInstanceClassName()%>(<%=constant%>__VALUE), <%=genDataType.isMaxInclusive() ? "true" : "false"%>, <%=diagnostics%>, <%=context%>);
433 <%} else {%>
434 reportMaxViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, <%=constant%>__VALUE, <%=genDataType.isMaxInclusive() ? "true" : "false"%>, <%=diagnostics%>, <%=context%>);
435 <%}%>
436 return <%=result%>;
437 <%} else { String comparison = "comparison".equals(genClassifier.getSafeUncapName()) ? "theComparison" : "comparison";%>
438 <%if (genDataType.isXMLCalendar()) {%>
439 int <%=comparison%> = <%=genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil")%>.compareCalendar(<%=genDataType.getSafeUncapName()%>, <%=constant%>__VALUE);
440 boolean <%=result%> = <%if (genDataType.isMaxInclusive()) {%><%=comparison%> == 0 || <%}%><%=comparison%> == -1;
441 <%} else if (genDataType.isXMLDuration()) {%>
442 int <%=comparison%> = <%=genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil")%>.compareDuration(<%=genDataType.getSafeUncapName()%>, <%=constant%>__VALUE);
443 boolean <%=result%> = <%if (genDataType.isMaxInclusive()) {%><%=comparison%> == 0 || <%}%><%=comparison%> == -1;
444 <%} else {%>
445 boolean <%=result%> = <%=genDataType.getSafeUncapName()%>.compareTo(<%=constant%>__VALUE) <%=genDataType.isMaxInclusive() ? "<=" : "<"%> 0;
446 <%}%>
447 if (!<%=result%> && <%=diagnostics%> != null)
448 reportMaxViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, <%=constant%>__VALUE, <%=genDataType.isMaxInclusive() ? "true" : "false"%>, <%=diagnostics%>, <%=context%>);
449 return <%=result%>;
450 <%}%>
451 <%} else if (constraint.equals("MinLength") && genDataType.getMinLength() != -1) {%>
452 int length = <%=genDataType.getSafeUncapName()%>.<%=genDataType.getLengthAccessorFunction()%>;
453 boolean <%=result%> = length >= <%=genDataType.getMinLength()%>;
454 if (!<%=result%> && <%=diagnostics%> != null)
455 reportMinLengthViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, length, <%=genDataType.getMinLength()%>, <%=diagnostics%>, <%=context%>);
456 return <%=result%>;
457 <%} else if (constraint.equals("MaxLength") && genDataType.getMaxLength() != -1) {%>
458 int length = <%=genDataType.getSafeUncapName()%>.<%=genDataType.getLengthAccessorFunction()%>;
459 boolean <%=result%> = length <= <%=genDataType.getMaxLength()%>;
460 if (!<%=result%> && <%=diagnostics%> != null)
461 reportMaxLengthViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, length, <%=genDataType.getMaxLength()%>, <%=diagnostics%>, <%=context%>);
462 return <%=result%>;
463 <%} else if (constraint.equals("TotalDigits") && genDataType.getTotalDigits() != -1) {%>
464 <%if (genDataType.isPrimitiveType()) {%>
465 boolean <%=result%> = <%=genDataType.getSafeUncapName()%> > <%=constant%>__LOWER_BOUND && <%=genDataType.getSafeUncapName()%> < <%=constant%>__UPPER_BOUND;
466 if (!<%=result%> && <%=diagnostics%> != null)
467 <%if (genModel.getComplianceLevel().getValue() < GenJDKLevel.JDK50) {%>
468 reportTotalDigitsViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, new <%=genDataType.getObjectInstanceClassName()%>(<%=genDataType.getSafeUncapName()%>), <%=genDataType.getTotalDigits()%>, <%=diagnostics%>, <%=context%>);
469 <%} else {%>
470 reportTotalDigitsViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, <%=genDataType.getTotalDigits()%>, <%=diagnostics%>, <%=context%>);
471 <%}%>
472 <%} else if ("java.math.BigDecimal".equals(genDataType.getQualifiedInstanceClassName())) {%>
473 int scale = <%=genDataType.getSafeUncapName()%>.scale();
474 int totalDigits = scale < 0 ? <%=genDataType.getSafeUncapName()%>.precision() - scale : <%=genDataType.getSafeUncapName()%>.precision();
475 boolean <%=result%> = totalDigits <= <%=genDataType.getTotalDigits()%>;
476 if (!<%=result%> && <%=diagnostics%> != null)
477 reportTotalDigitsViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, <%=genDataType.getTotalDigits()%>, <%=diagnostics%>, <%=context%>);
478 <%} else {%>
479 boolean <%=result%> = <%=genDataType.getSafeUncapName()%>.compareTo(<%=constant%>__LOWER_BOUND) > 0 && <%=genDataType.getSafeUncapName()%>.compareTo(<%=constant%>__UPPER_BOUND) < 0;
480 if (!<%=result%> && <%=diagnostics%> != null)
481 reportTotalDigitsViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, <%=genDataType.getTotalDigits()%>, <%=diagnostics%>, <%=context%>);
482 <%}%>
483 return <%=result%>;
484 <%} else if (constraint.equals("FractionDigits") && genDataType.getFractionDigits() != -1 && "java.math.BigDecimal".equals(genDataType.getQualifiedInstanceClassName())) {%>
485 boolean <%=result%> = <%=genDataType.getSafeUncapName()%>.scale() <= <%=genDataType.getFractionDigits()%>;
486 if (!<%=result%> && <%=diagnostics%> != null)
487 reportFractionDigitsViolation(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genDataType.getSafeUncapName()%>, <%=genDataType.getFractionDigits()%>, <%=diagnostics%>, <%=context%>);
488 return <%=result%>;
489 <%} else if (constraintDelegate != null) {%>
490 // TODO override the constraint, if desired
491 // -> uncomment the scaffolding
492 // -> specify the condition that violates the constraint
493 // -> verify the diagnostic details, including severity, code, and message
494 // Ensure that you remove @generated or mark it @generated NOT
495 if (false)
496 {
497 if (<%=diagnostics%> != null)
498 {
499 <%=diagnostics%>.add
500 <%if (genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF24_VALUE) {%>
501 (createDiagnostic
502 (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
503 DIAGNOSTIC_SOURCE,
504 0,
505 "_UI_GenericConstraint_diagnostic",<%=genModel.getNonNLS()%>
506 new Object[] { "<%=constraint%>", getValueLabel(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genClassifier.getSafeUncapName()%>, <%=context%>) },<%=genModel.getNonNLS()%>
507 new Object[] { <%=genClassifier.getSafeUncapName()%> },
508 context));
509 <%} else {%>
510 (new <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")%>
511 (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
512 DIAGNOSTIC_SOURCE,
513 0,
514 <%=genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")%>.INSTANCE.getString("_UI_GenericConstraint_diagnostic", new Object[] { "<%=constraint%>", getValueLabel(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genClassifier.getSafeUncapName()%>, <%=context%>) }),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%>
515 new Object[] { <%=genClassifier.getSafeUncapName()%> }));
516 <%}%>
517 }
518 return false;
519 }
520 return <%=delegate%>validate<%=constraintDelegate.getName()%>_<%=constraint%>(<%=genClassifier.getSafeUncapName()%><%=accessor%>, <%=diagnostics%>, <%=context%>);
521 <%} else {%>
522 <%if (genClassifier.hasConstraintExpression(constraint)) {%>
523 return
524 validate
525 (<%=genClassifier.getQualifiedClassifierAccessor()%>,
526 <%=genClassifier.getSafeUncapName()%>,
527 <%=diagnostics%>,
528 <%=context%>,
529 "<%=genClassifier.getValidationDelegate(constraint)%>",<%=genModel.getNonNLS()%>
530 "<%=constraint%>",<%=genModel.getNonNLS()%>
531 <%=genClassifier.getClassifierID()%>__<%=CodeGenUtil.upperName(constraint)%>__EEXPRESSION,
532 <%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
533 DIAGNOSTIC_SOURCE,
534 0);
535 <%} else {%>
536 // TODO implement the constraint
537 // -> specify the condition that violates the constraint
538 // -> verify the diagnostic details, including severity, code, and message
539 // Ensure that you remove @generated or mark it @generated NOT
540 if (false)
541 {
542 if (<%=diagnostics%> != null)
543 {
544 <%=diagnostics%>.add
545 <%if (genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF24_VALUE) {%>
546 (createDiagnostic
547 (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
548 DIAGNOSTIC_SOURCE,
549 0,
550 "_UI_GenericConstraint_diagnostic",<%=genModel.getNonNLS()%>
551 new Object[] { "<%=constraint%>", getValueLabel(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genClassifier.getSafeUncapName()%>, <%=context%>) },<%=genModel.getNonNLS()%>
552 new Object[] { <%=genClassifier.getSafeUncapName()%> },
553 context));
554 <%} else {%>
555 (new <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")%>
556 (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
557 DIAGNOSTIC_SOURCE,
558 0,
559 <%=genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")%>.INSTANCE.getString("_UI_GenericConstraint_diagnostic", new Object[] { "<%=constraint%>", getValueLabel(<%=genDataType.getQualifiedClassifierAccessor()%>, <%=genClassifier.getSafeUncapName()%>, <%=context%>) }),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%>
560 new Object[] { <%=genClassifier.getSafeUncapName()%> }));
561 <%}%>
562 }
563 return false;
564 }
565 return true;
566 <%}%>
567 <%}%>
568 <%} else { GenOperation genOperation = ((GenClass)genClassifier).getInvariantOperation(constraint); if (genOperation != null) {%>
569 return <%=genClassifier.getSafeUncapName()%>.<%=constraint%>(<%=diagnostics%>, <%=context%>);
570 <%} else if (constraintDelegate != null) {%>
571 // TODO override the constraint, if desired
572 // -> uncomment the scaffolding
573 // -> specify the condition that violates the constraint
574 // -> verify the diagnostic details, including severity, code, and message
575 // Ensure that you remove @generated or mark it @generated NOT
576 if (false)
577 {
578 if (<%=diagnostics%> != null)
579 {
580 <%=diagnostics%>.add
581 <%if (genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF24_VALUE) {%>
582 (createDiagnostic
583 (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
584 DIAGNOSTIC_SOURCE,
585 0,
586 "_UI_GenericConstraint_diagnostic",<%=genModel.getNonNLS()%>
587 new Object[] { "<%=constraint%>", getObjectLabel(<%=genClassifier.getSafeUncapName()%>, <%=context%>) },<%=genModel.getNonNLS()%>
588 new Object[] { <%=genClassifier.getSafeUncapName()%> },
589 context));
590 <%} else {%>
591 (new <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")%>
592 (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
593 DIAGNOSTIC_SOURCE,
594 0,
595 <%=genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")%>.INSTANCE.getString("_UI_GenericConstraint_diagnostic", new Object[] { "<%=constraint%>", getObjectLabel(<%=genClassifier.getSafeUncapName()%>, <%=context%>) }),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%>
596 new Object[] { <%=genClassifier.getSafeUncapName()%> }));
597 <%}%>
598 }
599 return false;
600 }
601 return <%=delegate%>validate<%=constraintDelegate.getName()%>_<%=constraint%>(<%=cast%><%=genClassifier.getSafeUncapName()%>, <%=diagnostics%>, <%=context%>);
602 <%} else {%>
603 <%if (genClassifier.hasConstraintExpression(constraint)) {%>
604 return
605 validate
606 (<%=genClassifier.getQualifiedClassifierAccessor()%>,
607 <%if (!((GenClass)genClassifier).isEObjectExtension()) {%>(<%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%>)<%}%><%=genClassifier.getSafeUncapName()%>,
608 <%=diagnostics%>,
609 <%=context%>,
610 "<%=genClassifier.getValidationDelegate(constraint)%>",<%=genModel.getNonNLS()%>
611 "<%=constraint%>",<%=genModel.getNonNLS()%>
612 <%=genClassifier.getClassifierID()%>__<%=CodeGenUtil.upperName(constraint)%>__EEXPRESSION,
613 <%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
614 DIAGNOSTIC_SOURCE,
615 0);
616 <%} else {%>
617 // TODO implement the constraint
618 // -> specify the condition that violates the constraint
619 // -> verify the diagnostic details, including severity, code, and message
620 // Ensure that you remove @generated or mark it @generated NOT
621 if (false)
622 {
623 if (<%=diagnostics%> != null)
624 {
625 <%=diagnostics%>.add
626 <%if (genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF24_VALUE) {%>
627 (createDiagnostic
628 (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
629 DIAGNOSTIC_SOURCE,
630 0,
631 "_UI_GenericConstraint_diagnostic",<%=genModel.getNonNLS()%>
632 new Object[] { "<%=constraint%>", getObjectLabel(<%=genClassifier.getSafeUncapName()%>, <%=context%>) },<%=genModel.getNonNLS()%>
633 new Object[] { <%=genClassifier.getSafeUncapName()%> },
634 context));
635 <%} else {%>
636 (new <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")%>
637 (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR,
638 DIAGNOSTIC_SOURCE,
639 0,
640 <%=genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")%>.INSTANCE.getString("_UI_GenericConstraint_diagnostic", new Object[] { "<%=constraint%>", getObjectLabel(<%=genClassifier.getSafeUncapName()%>, <%=context%>) }),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%>
641 new Object[] { <%=genClassifier.getSafeUncapName()%> }));
642 <%}%>
643 }
644 return false;
645 }
646 return true;
647 <%}%>
648 <%}}%>
649 }
650
651 <%}%>
652 <%}%>
653 <%if (genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF24_VALUE) {%>
654 /**
655 * Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
656 * <!-- begin-user-doc -->
657 * <!-- end-user-doc -->
658 * @generated
659 */
660 <%if (genModel.useClassOverrideAnnotation()) {%>
661 @Override
662 <%}%>
663 public <%=genModel.getImportedName("org.eclipse.emf.common.util.ResourceLocator")%> getResourceLocator()
664 {
665 <%if (genModel.hasModelPluginClass()) {%>
666 return <%=genModel.getImportedName(genModel.getQualifiedModelPluginClassName())%>.INSTANCE;
667 <%} else {%>
668 // TODO
669 // Specialize this to return a resource locator for messages specific to this validator.
670 // Ensure that you remove @generated or mark it @generated NOT
671 return super.getResourceLocator();
672 <%}%>
673 }
674
675 <%}%>
676 <%@ include file="ValidatorClass/insert.javajetinc" fail="silent" %>
677 } //<%=genPackage.getValidatorClassName()%>
678 <%genModel.emitSortedImports();%>