org.eclipse.ocl.ecore.delegate
Class AbstractDelegatedBehavior.ExpressionCacheAdapter
java.lang.Object
org.eclipse.emf.common.notify.impl.AdapterImpl
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 classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter |
org.eclipse.emf.common.notify.Adapter.Internal |
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl |
target |
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 |
AbstractDelegatedBehavior.ExpressionCacheAdapter
public AbstractDelegatedBehavior.ExpressionCacheAdapter(OCLExpression expression)
cacheOCLExpression
public static void cacheOCLExpression(org.eclipse.emf.ecore.EModelElement modelElement,
OCLExpression e)
- Creates an
ExpressionCacheAdapter
for expression e
and adds
it to modelElement
's adapter list so that getCachedOCLExpression(EModelElement)
will return e
when called for modelElement
. To achieve this, any other
ExpressionCacheAdapter
in modelElement
's adapter list is removed.
- Parameters:
e
- if null
, any existing cache entry is removed and no new entry
is created. getCachedOCLExpression(EModelElement)
will then return null
.
getCachedOCLExpression
public static OCLExpression getCachedOCLExpression(org.eclipse.emf.ecore.EModelElement modelElement)
- Looks for an
ExpressionCacheAdapter
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