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); }
if (ocl.isInvalid(result)) { String message = NLS.bind(OCLMessages.EvaluationResultIsInvalid_ERROR_, getOperationName()); throw new org.eclipse.ocl.ecore.delegate.OCLDelegateException(message);
@Override protected Object get(InternalEObject owner, boolean resolve, boolean coreType) { OCL ocl = delegateDomain.getOCL(); if (derivation == null) { derivation = SettingBehavior.INSTANCE.getFeatureBody(ocl, eStructuralFeature); } if (derivation == null) { String message = NLS.bind(OCLMessages.MissingDerivationForSettingDelegate_ERROR_, getFeatureName()); throw new org.eclipse.ocl.ecore.delegate.OCLDelegateException(message); } OCL.Query query = ocl.createQuery(derivation); Object result = query.evaluate(owner); if (ocl.isInvalid(result)) { String message = NLS.bind(OCLMessages.EvaluationResultIsInvalid_ERROR_, getFeatureName()); throw new org.eclipse.ocl.ecore.delegate.OCLDelegateException(message); } // if ((result == null) /* || ocl.isInvalid(result) */) { // String message = NLS.bind(OCLMessages.EvaluationResultIsNull_ERROR_, getFeatureName()); // throw new org.eclipse.ocl.ecore.delegate.OCLDelegateException(message); // } return converter.convert(ocl, result); }