java.lang.Object
com.erudika.para.server.aop.IndexAndCacheAspect
- All Implemented Interfaces:
org.aopalliance.aop.Advice
,org.aopalliance.intercept.Interceptor
,org.aopalliance.intercept.MethodInterceptor
public class IndexAndCacheAspect
extends Object
implements org.aopalliance.intercept.MethodInterceptor
This is the core method interceptor which enables caching and indexing.
It listens for calls to annotated
DAO
methods
and adds searching and caching functionality to them. This technique allows us to control
the caching and searching centrally for all implementations
of the DAO
interface.- Author:
- Alex Bogdanovski [[email protected]]
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.erudika.para.core.cache.Cache
getCache()
getter/setter.com.erudika.para.core.search.Search
getter/setter.invoke
(org.aopalliance.intercept.MethodInvocation mi) Executes code when a method is invoked.void
setCache
(com.erudika.para.core.cache.Cache cache) getter/setter.void
setSearch
(com.erudika.para.core.search.Search search) getter/setter.
-
Constructor Details
-
IndexAndCacheAspect
public IndexAndCacheAspect()Constructor.
-
-
Method Details
-
getSearch
public com.erudika.para.core.search.Search getSearch()getter/setter.- Returns:
Search
-
setSearch
@Inject public void setSearch(com.erudika.para.core.search.Search search) getter/setter.- Parameters:
search
-Search
-
getCache
public com.erudika.para.core.cache.Cache getCache()getter/setter.- Returns:
Cache
-
setCache
@Inject public void setCache(com.erudika.para.core.cache.Cache cache) getter/setter.- Parameters:
cache
-Cache
-
invoke
Executes code when a method is invoked. A big switch statement.- Specified by:
invoke
in interfaceorg.aopalliance.intercept.MethodInterceptor
- Parameters:
mi
- method invocation- Returns:
- the returned value of the method invoked or something else (decided here)
- Throws:
Throwable
- error
-