public class ReflectionResolver extends AbstractResolver implements com.google.common.cache.RemovalListener<org.trimou.engine.resolver.MemberKey,com.google.common.base.Optional<org.trimou.engine.resolver.MemberWrapper>>
Reflections.findField(Class, String),
Reflections.findMethod(Class, String)| Modifier and Type | Field and Description |
|---|---|
static String |
COMPUTING_CACHE_CONSUMER_ID |
static ConfigurationKey |
MEMBER_CACHE_MAX_SIZE_KEY
Limit the size of the cache (e.g. to avoid problems when dynamic class
compilation is involved).
|
static int |
REFLECTION_RESOLVER_PRIORITY |
configurationBUILTIN_RESOLVERS_DEFAULT_PRIORITY, BUILTIN_TEMPLATE_LOCATORS_DEFAULT_PRIORITY, EXTENSION_RESOLVERS_DEFAULT_PRIORITY| Constructor and Description |
|---|
ReflectionResolver() |
ReflectionResolver(int priority) |
| Modifier and Type | Method and Description |
|---|---|
Set<ConfigurationKey> |
getConfigurationKeys() |
void |
init()
Can be overridden so that there's no need to call
super.init(Configuration). |
void |
invalidateMemberCache(com.google.common.base.Predicate<Class<?>> predicate)
|
void |
onRemoval(com.google.common.cache.RemovalNotification<org.trimou.engine.resolver.MemberKey,com.google.common.base.Optional<org.trimou.engine.resolver.MemberWrapper>> notification) |
Object |
resolve(Object contextObject,
String name,
ResolutionContext context)
Resolve the value from specified context object and name.
|
getPriority, toStringcheckNotInitialized, initclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitinitpublic static final int REFLECTION_RESOLVER_PRIORITY
public static final String COMPUTING_CACHE_CONSUMER_ID
public static final ConfigurationKey MEMBER_CACHE_MAX_SIZE_KEY
public ReflectionResolver()
public ReflectionResolver(int priority)
public Object resolve(Object contextObject, String name, ResolutionContext context)
Resolvernull in case of the resolver is not capable
of resolving it.
ResolutionContext allows to register a callback to release all
the relevant resources after the resolved value is used.public void init()
AbstractConfigurationAwaresuper.init(Configuration).init in class AbstractConfigurationAwarepublic Set<ConfigurationKey> getConfigurationKeys()
getConfigurationKeys in interface ConfigurationAwaregetConfigurationKeys in class AbstractConfigurationAwarepublic void onRemoval(com.google.common.cache.RemovalNotification<org.trimou.engine.resolver.MemberKey,com.google.common.base.Optional<org.trimou.engine.resolver.MemberWrapper>> notification)
onRemoval in interface com.google.common.cache.RemovalListener<org.trimou.engine.resolver.MemberKey,com.google.common.base.Optional<org.trimou.engine.resolver.MemberWrapper>>public void invalidateMemberCache(com.google.common.base.Predicate<Class<?>> predicate)
Class and Member instances. As a temporary
workaround we provide a way to invalidate the cache or some of its
entries (e.g. for a concrete classloader).predicate - If null, all cache entries are discarded, otherwise an entry
is only discarded if the given predicate returns
true for the Object.getClass()Copyright © 2015. All Rights Reserved.