envFactory = new EcoreEnvironmentFactory(packageRegistry); this.ocl = OCL.newInstance(envFactory);
@Override protected OCLExpression<EClassifier> getPropertyBody( EStructuralFeature property) { OCLExpression<EClassifier> result = SettingBehavior.INSTANCE .getCachedOCLExpression(property); if (result == SettingBehavior.NO_OCL_DEFINITION) { result = null; } else if (result == null) { if (SettingBehavior.INSTANCE.hasCompileableFeatureBody(property)) { OCL ocl = OCL.newInstance(getEnvironment().getFactory()); result = SettingBehavior.INSTANCE.getFeatureBody(ocl, property); ocl.dispose(); } if (result == null) { result = super.getPropertyBody(property); } } return result; }
/** * Tries to fetch an operation body from where the * {@link OCLInvocationDelegate OCL invocation delegate} stores it. If nothing * is found, this method delegates to the base class implementation which then * performs the usual search in the OCL_NAMESPACE_URI annotation and the * environment's body condition cache. */ @Override protected OCLExpression<EClassifier> getOperationBody(EOperation operation) { OCLExpression<EClassifier> result = InvocationBehavior.INSTANCE .getCachedOCLExpression(operation); if (result == InvocationBehavior.NO_OCL_DEFINITION) { result = null; } else if (result == null) { if (InvocationBehavior.INSTANCE.hasCompileableOperationBody(operation)) { OCL ocl = OCL.newInstance(getEnvironment().getFactory()); result = InvocationBehavior.INSTANCE.getOperationBody(ocl, operation); ocl.dispose(); } if (result == null) { result = super.getOperationBody(operation); } } return result; }