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.emf.ecore.util.EObjectValidator;

/**
 * <!-- 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.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* that indicates that the class interface is manually defined. Do not use *@generated NOT* since that indicates that the whole class is manually defined.

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.


