blob: 4f8e5b72633ca6865f3c8e0196b6a410f4824e90 [file] [log] [blame]
h2(#Validators). Validators
When using the pivot metamodel, there are two specialized validators available to support integration of OCL in to a larger Ecore environment.
h3(#OCLinEcoreEObjectValidator). OCLinEcoreEObjectValidator
Unfortunately, in the Indigo release, EMF does not support this customization and so must be activated by explicitly using an EValidator that is aware of the ValidationDelegateExtension extended API. This is available by using the OCLinEcoreEObjectValidator, which you may install globally by:
bc..
EValidator.Registry.INSTANCE.put(null, new OCLinEcoreEObjectValidator());
p.
or more selectively by adjusting the inheritance of the Validator class generated by EMF from (for a model of a Company):
bc..
import org.eclipse.ocl.examples.xtext.oclinecore.validation.OCLinEcoreEObjectValidator;
/**
* <!-- begin-user-doc -->
* The <b>Validator</b> for the model.
* <!-- end-user-doc -->
* @see company.CompanyPackage
*/
public class CompanyValidator extends EObjectValidator {
p.
to
bc..
import org.eclipse.ocl.examples.xtext.oclinecore.validation.OCLinEcoreEObjectValidator;
/**
* <!-- begin-user-doc -->
* The <b>Validator</b> for the model.
* <!-- end-user-doc -->
* @see company.CompanyPackage
* @generated not
*/
public class CompanyValidator extends OCLinEcoreEObjectValidator {
p.
Note the *@generated not* to preserve the change when genmodel is run again.
h3(#CompleteOCLEObjectValidator). CompleteOCLEObjectValidator
The CompleteOCLEObjectValidator is used to enable Complete OCL documents to participate in the validation processing of an Xtext editor.
The APIs for merging Complete OCL and Ecore as intermediate Pivots and then migrating the Pivot back to Ecore are experimental.