org.eclipse.ocl.ecore.delegate
Class AbstractDelegatedBehavior.ExpressionCacheAdapter

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.ocl.ecore.delegate.AbstractDelegatedBehavior.ExpressionCacheAdapter
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal
Enclosing class:
AbstractDelegatedBehavior<E extends org.eclipse.emf.ecore.EModelElement,R,F>

protected static class AbstractDelegatedBehavior.ExpressionCacheAdapter
extends org.eclipse.emf.common.notify.impl.AdapterImpl

Caches a single OCL expression in an adapter that can be attached, e.g., to an Ecore object without "modifying" the object to which the adapter gets attached.

Since:
3.1

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
 
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
target
 
Constructor Summary
AbstractDelegatedBehavior.ExpressionCacheAdapter(OCLExpression expression)
           
 
Method Summary
static void cacheOCLExpression(org.eclipse.emf.ecore.EModelElement modelElement, OCLExpression e)
          Creates an OCLExpressionCacheAdapter for expression e and adds it to modelElement's adapter list so that #getCachedOCLExpression(Notifier) will return e when called for modelElement.
static OCLExpression getCachedOCLExpression(org.eclipse.emf.ecore.EModelElement modelElement)
          Looks for an OCLExpressionCacheAdapter attached to modelElement.
 OCLExpression getExpression()
           
 boolean isAdapterForType(java.lang.Object type)
           
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget, notifyChanged, setTarget, unsetTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDelegatedBehavior.ExpressionCacheAdapter

public AbstractDelegatedBehavior.ExpressionCacheAdapter(OCLExpression expression)
Method Detail

cacheOCLExpression

public static void cacheOCLExpression(org.eclipse.emf.ecore.EModelElement modelElement,
                                      OCLExpression e)
Creates an OCLExpressionCacheAdapter for expression e and adds it to modelElement's adapter list so that #getCachedOCLExpression(Notifier) will return e when called for modelElement. To achieve this, any other OCLExpressionCacheAdapter in modelElement's adapter list is removed.

Parameters:
e - if null, any existing cache entry is removed and no new entry is created. #getCachedOCLExpression(Notifier) will then return null.

getCachedOCLExpression

public static OCLExpression getCachedOCLExpression(org.eclipse.emf.ecore.EModelElement modelElement)
Looks for an OCLExpressionCacheAdapter attached to modelElement. If such an adapter is found, its cached expression is returned. The cached expression may be a reserved expression indicating that no OCL expression exists and that an unsuccessful attempt to obtain one has been made before. AbstractDelegatedBehavior.isNoOCLDefinition(OCLExpression) should be used to check for the reserved expression. null is returned if no cached expression is available.


getExpression

public OCLExpression getExpression()

isAdapterForType

public boolean isAdapterForType(java.lang.Object type)
Specified by:
isAdapterForType in interface org.eclipse.emf.common.notify.Adapter
Overrides:
isAdapterForType in class org.eclipse.emf.common.notify.impl.AdapterImpl