protected boolean check(Object object, String constraint, OCLExpression query) { OCL ocl = delegateDomain.getOCL(); OCLStandardLibrary<EClassifier> stdlib = ocl.getEnvironment().getOCLStandardLibrary(); if (query.getType() != stdlib.getBoolean()) { String message = NLS.bind(OCLMessages.ValidationConstraintIsNotBoolean_ERROR_, constraint); throw new org.eclipse.ocl.ecore.delegate.OCLDelegateException(message); } Object result = ocl.evaluate(object, query); if (ocl.isInvalid(result)) { String message = NLS.bind(OCLMessages.ValidationResultIsInvalid_ERROR_, constraint); throw new org.eclipse.ocl.ecore.delegate.OCLDelegateException(message); } if ((result == null) /* || ocl.isInvalid(result) */) { String message = NLS.bind(OCLMessages.ValidationResultIsNull_ERROR_, constraint); throw new org.eclipse.ocl.ecore.delegate.OCLDelegateException(message); } if (!(result instanceof Boolean)) { String message = NLS.bind(OCLMessages.ValidationResultIsNotBoolean_ERROR_, constraint); throw new org.eclipse.ocl.ecore.delegate.OCLDelegateException(message); } return Boolean.TRUE.equals(result); }
Environment<EPackage, EClassifier, EOperation, EStructuralFeature, EEnumLiteral, EParameter, EObject, CallOperationAction, SendSignalAction, Constraint, EClass, EObject> env = ocl.getEnvironment(); EClassifier contextType = evalEnv.getType(target); if (!TypeUtil.compatibleTypeMatch(env, contextType, context)) {