net.sf.mmm.util.pojo.path.api
Interface PojoPathContext

All Known Implementing Classes:
DefaultPojoPathContext, PojoPathContextBean

public interface PojoPathContext

This is the interface of an object that carries the context for a PojoPathNavigator. The context gives control and state to the caller of the PojoPathNavigator allowing to be fast and thread-safe as well as being extendable.

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Method Summary
 ComposedValueConverter getAdditionalConverter()
          This method gets an optional ComposedValueConverter that is used in favor to ComposedValueConverter registered to the PojoPathNavigator itself.
 PojoPathFunctionManager getAdditionalFunctionManager()
          This method gets an optional PojoPathFunctionManager.
 Map<Object,Object> getCache()
          This method provides a cache that is used by the PojoPathNavigator to speed up repetitive calls with the same initial Pojo and PojoPaths with a common prefix.
 PojoFactory getPojoFactory()
          This method gets an optional PojoFactory instance used if favor to the PojoFactory registered to the PojoPathNavigator itself.
 Properties getProperties()
          This method gets the properties of the context.
 PojoPathRecognizer getRecognizer()
          This method gets an optional recognizer that adds support for the visitor-pattern.
 

Method Detail

getCache

Map<Object,Object> getCache()
This method provides a cache that is used by the PojoPathNavigator to speed up repetitive calls with the same initial Pojo and PojoPaths with a common prefix.
WARNING:
If caching is enabled and the initial or an intermediate Pojo changed outside the navigator the result will be wrong because the evaluation used an old value from the cache.
Please also note that the PojoPathNavigator only adds objects from the cache. It will never remove cached objects. To avoid memory-leaks, you should use a PojoPathContext instance only per transaction, per request, or whatever your grouping block will be.
ATTENTION:
Never make assumptions about the content of this cache. It is provided here to allow the PojoPathNavigator to be thread-safe and more efficient and NOT to expose it for external usage. The internal structure of the cache may change in future releases. Use the recognizer to track visited Pojos.

Returns:
a mutable Map to use as cache or null to disable caching.
See Also:
HashMap, WeakHashMap

getProperties

Properties getProperties()
This method gets the properties of the context. These can be accessed from PojoPathFunctions for evaluation. Please note that conditional evaluation can conflict with caching. Ensure that such PojoPathFunctions are declared to be NOT deterministic.

Returns:
the properties of this context.

getRecognizer

PojoPathRecognizer getRecognizer()
This method gets an optional recognizer that adds support for the visitor-pattern. Therefore all POJOs traversed by the PojoPathNavigator are recognized by the returned object.

Returns:
the PojoPathRecognizer or null to turn this feature off.

getAdditionalFunctionManager

PojoPathFunctionManager getAdditionalFunctionManager()
This method gets an optional PojoPathFunctionManager. PojoPathFunctions provided by this manager overrules the PojoPathFunctions that may be provided by the PojoPathNavigator itself. While PojoPathFunctions that may be registered globally in the PojoPathNavigator should be stateless and thread-safe, the PojoPathFunctions provided here may be stateful depending on the usage of this context.

Returns:
the PojoPathFunctionManager of this context or null if no context-specific PojoPathFunctions should be provided.

getAdditionalConverter

ComposedValueConverter getAdditionalConverter()
This method gets an optional ComposedValueConverter that is used in favor to ComposedValueConverter registered to the PojoPathNavigator itself.

Returns:
the ComposedValueConverter of this context or null if no context-specific ComposedValueConverter is provided.

getPojoFactory

PojoFactory getPojoFactory()
This method gets an optional PojoFactory instance used if favor to the PojoFactory registered to the PojoPathNavigator itself. The PojoFactory is used to create new Pojos.

Returns:
the PojoFactory or null if no context-specific PojoFactory is provided.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.