Package com.adaptris.core.services.cache
Class CacheEntryEvaluator
- java.lang.Object
-
- com.adaptris.core.services.cache.CacheEntryEvaluator
-
public class CacheEntryEvaluator extends java.lang.Object
Evaluates cache keys and values for the various cache services.In the adapter configuration file this class is aliased as cache-entry-evaluator which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheEntryEvaluator.NullCacheValueTranslator
-
Constructor Summary
Constructors Constructor Description CacheEntryEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
friendlyName()
java.lang.Boolean
getErrorOnEmptyKey()
java.lang.Boolean
getErrorOnEmptyValue()
java.lang.String
getFriendlyName()
protected java.lang.String
getKey(AdaptrisMessage msg)
CacheKeyTranslator
getKeyTranslator()
Get the configured key translator.protected java.lang.Object
getValue(AdaptrisMessage msg)
CacheValueTranslator
getValueTranslator()
Get the configured value translator.CacheKeyTranslator
keyTranslator()
Get the key translator.void
setErrorOnEmptyKey(java.lang.Boolean bool)
Throw an error if we cannot look up the Key valuevoid
setErrorOnEmptyValue(java.lang.Boolean bool)
Throw an error if we cannot look up the Value to be stored in the cachevoid
setFriendlyName(java.lang.String name)
Set the name of this cache entry generator for logging purposes.void
setKeyTranslator(CacheKeyTranslator translator)
Sets the translator to use to extract the Key value from the messagevoid
setValueTranslator(CacheValueTranslator translator)
Sets the translator to extract the Value to be stored in the cacheCacheValueTranslator
valueTranslator()
Get the value translator.
-
-
-
Method Detail
-
getKey
protected java.lang.String getKey(AdaptrisMessage msg) throws ServiceException
- Throws:
ServiceException
-
getValue
protected java.lang.Object getValue(AdaptrisMessage msg) throws ServiceException
- Throws:
ServiceException
-
setErrorOnEmptyKey
public void setErrorOnEmptyKey(java.lang.Boolean bool)
Throw an error if we cannot look up the Key value- Parameters:
bool
- default is true.
-
getErrorOnEmptyKey
public java.lang.Boolean getErrorOnEmptyKey()
-
setErrorOnEmptyValue
public void setErrorOnEmptyValue(java.lang.Boolean bool)
Throw an error if we cannot look up the Value to be stored in the cache- Parameters:
bool
- default is true.
-
getErrorOnEmptyValue
public java.lang.Boolean getErrorOnEmptyValue()
-
setKeyTranslator
public void setKeyTranslator(CacheKeyTranslator translator)
Sets the translator to use to extract the Key value from the message- Parameters:
translator
- default is null.
-
getKeyTranslator
public CacheKeyTranslator getKeyTranslator()
Get the configured key translator.- Returns:
- the configured key translator.
-
keyTranslator
public CacheKeyTranslator keyTranslator()
Get the key translator.- Returns:
- the configured key translator via
setKeyTranslator(CacheKeyTranslator)
or a default translator if null.
-
setValueTranslator
public void setValueTranslator(CacheValueTranslator translator)
Sets the translator to extract the Value to be stored in the cache- Parameters:
translator
- default is null.
-
getValueTranslator
public CacheValueTranslator getValueTranslator()
Get the configured value translator.- Returns:
- the configured value translator.
-
valueTranslator
public CacheValueTranslator valueTranslator()
Get the value translator.- Returns:
- the configured key translator via
setValueTranslator(CacheValueTranslator)
or a default translator if null.
-
getFriendlyName
public java.lang.String getFriendlyName()
-
setFriendlyName
public void setFriendlyName(java.lang.String name)
Set the name of this cache entry generator for logging purposes.- Parameters:
name
-
-
friendlyName
public java.lang.String friendlyName()
-
-