org.eclipse.jst.jsf.designtime.resolver
Class CachingSymbolContextResolver

java.lang.Object
  extended by org.eclipse.jst.jsf.designtime.resolver.AbstractSymbolContextResolver
      extended by org.eclipse.jst.jsf.designtime.resolver.CachingSymbolContextResolver
All Implemented Interfaces:
IContextResolver, IDocumentContextResolver, ISymbolContextResolver

public final class CachingSymbolContextResolver
extends AbstractSymbolContextResolver

A symbol resolver that delegates to the default SymbolContextResolver, but caches the results and returns those on subsequent calls. WARNING: this resolver is suitable *only* in situations where the state of dependent symbol sources won't change between calls. This resolver makes no attempt to ensure that cached data is in sync with changes to symbols such addition, modification or removal of Java class underlying beans. NOTE: this resolver is experimental and should NOT be considered API Clients should not use this resolver directly. Access it through the factory instead


Constructor Summary
CachingSymbolContextResolver(IStructuredDocumentContext context)
           
 
Method Summary
 boolean canResolveContext(IModelContext modelContext)
           
 ISymbol[] getAllVariables()
           
 IMethodSymbol getMethod(IObjectSymbol base, java.lang.Object methodName)
           
 ISymbol[] getMethods(IObjectSymbol base)
           
 ISymbol[] getProperties(ISymbol symbol)
           
 ISymbol getProperty(ISymbol symbol, java.lang.Object propertyName)
           
 ISymbol getVariable(java.lang.String name)
          Gets the most appropriate symbol in the current context based on name.
 boolean hasSameResolution(IModelContext modelContext)
          Default implementation We should avoid returning true unless we are positive that changing to this context won't change the way symbols are resolved.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingSymbolContextResolver

public CachingSymbolContextResolver(IStructuredDocumentContext context)
Parameters:
context -
Method Detail

canResolveContext

public boolean canResolveContext(IModelContext modelContext)
Specified by:
canResolveContext in interface IContextResolver
Specified by:
canResolveContext in class AbstractSymbolContextResolver
Returns:
true if this resolver can resolve context information based on this context

getAllVariables

public ISymbol[] getAllVariables()
Specified by:
getAllVariables in interface ISymbolContextResolver
Specified by:
getAllVariables in class AbstractSymbolContextResolver
Returns:
all valid symbols in the current context

getMethod

public IMethodSymbol getMethod(IObjectSymbol base,
                               java.lang.Object methodName)
Specified by:
getMethod in interface ISymbolContextResolver
Specified by:
getMethod in class AbstractSymbolContextResolver
Returns:
the method of base matching methodName or null if not found

getMethods

public ISymbol[] getMethods(IObjectSymbol base)
Specified by:
getMethods in interface ISymbolContextResolver
Specified by:
getMethods in class AbstractSymbolContextResolver
Returns:
all methods belonging to base

getProperties

public ISymbol[] getProperties(ISymbol symbol)
Specified by:
getProperties in interface ISymbolContextResolver
Specified by:
getProperties in class AbstractSymbolContextResolver
Returns:
all properties of symbol

getProperty

public ISymbol getProperty(ISymbol symbol,
                           java.lang.Object propertyName)
Specified by:
getProperty in interface ISymbolContextResolver
Specified by:
getProperty in class AbstractSymbolContextResolver
Returns:
the property symbol called propertyName or null if not found

getVariable

public ISymbol getVariable(java.lang.String name)
Description copied from interface: ISymbolContextResolver
Gets the most appropriate symbol in the current context based on name. Most "appropriate" may take into account scoping and other rules.

Specified by:
getVariable in interface ISymbolContextResolver
Specified by:
getVariable in class AbstractSymbolContextResolver
Returns:
a symbol

hasSameResolution

public boolean hasSameResolution(IModelContext modelContext)
Description copied from class: AbstractSymbolContextResolver
Default implementation We should avoid returning true unless we are positive that changing to this context won't change the way symbols are resolved.

Specified by:
hasSameResolution in interface ISymbolContextResolver
Overrides:
hasSameResolution in class AbstractSymbolContextResolver
Returns:
true if the instance of this resolver would resolve everything exactly the same with this modelContext. False otherwise.