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 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 |
BUILTIN_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 |
|---|---|
java.util.Set<ConfigurationKey> |
getConfigurationKeys() |
void |
init(Configuration configuration)
Initialize the component.
|
void |
invalidateMemberCache(com.google.common.base.Predicate<java.lang.Class<?>> predicate)
The member cache may theoretically cause memory leaks due to using hard
references to
Class and Member instances. |
void |
onRemoval(com.google.common.cache.RemovalNotification<org.trimou.engine.resolver.MemberKey,com.google.common.base.Optional<org.trimou.engine.resolver.MemberWrapper>> notification) |
java.lang.Object |
resolve(java.lang.Object contextObject,
java.lang.String name,
ResolutionContext context)
Resolve the value from specified context object and name.
|
getPriority, toStringcheckNotInitializedpublic static final int REFLECTION_RESOLVER_PRIORITY
public static final ConfigurationKey MEMBER_CACHE_MAX_SIZE_KEY
CacheBuilder.maximumSize(long)public ReflectionResolver()
public ReflectionResolver(int priority)
public java.lang.Object resolve(java.lang.Object contextObject,
java.lang.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(Configuration configuration)
ConfigurationAwareConfigurationAware components e.g. (
LocaleSupport).
This method must not be called directly by the application.init in interface ConfigurationAwareinit in class AbstractConfigurationAwarepublic java.util.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<java.lang.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 © 2014. All Rights Reserved.