public class ReflectionResolver extends AbstractResolver
Reflections#findField(Class, String),
Reflections#findMethod(Class, String)EnhancedResolver.Hint| Modifier and Type | Field and Description |
|---|---|
static String |
COMPUTING_CACHE_CONSUMER_ID |
static String |
GET_PREFIX |
static ConfigurationKey |
HINT_FALLBACK_ENABLED_KEY
Even if the runtime class of the context object changes try to apply the
resolver.
|
static String |
IS_PREFIX |
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 |
configurationDEFAULT_PRIORITY| Constructor and Description |
|---|
ReflectionResolver() |
ReflectionResolver(int priority) |
| Modifier and Type | Method and Description |
|---|---|
EnhancedResolver.Hint |
createHint(Object contextObject,
String name,
ResolutionContext context)
This method may only be called right after the
Resolver.resolve(Object, String, ResolutionContext) of the same resolver
returns a non-null value. |
Set<ConfigurationKey> |
getConfigurationKeys() |
void |
init()
Can be overridden so that there's no need to call
super.init(Configuration). |
void |
invalidateMemberCache(Predicate<Class<?>> predicate)
|
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 static final ConfigurationKey HINT_FALLBACK_ENABLED_KEY
public static final String GET_PREFIX
public static final String IS_PREFIX
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.
contextObject - The current context object (aka base object), may be
nullname - The name (the key or its part) is never nullcontext - The current resolution contextnullPlaceholder.NULLpublic EnhancedResolver.Hint createHint(Object contextObject, String name, ResolutionContext context)
EnhancedResolverResolver.resolve(Object, String, ResolutionContext) of the same resolver
returns a non-null value. The parameters must be the same.
The created hint is currently only used to skip the resolver chain for
the first part of a key of a variable tag, i.e. foo for
{{foo}} or {{foo.bar}}.
This method must not return null.
createHint in interface EnhancedResolvercreateHint in class AbstractResolverHints.INAPPLICABLE_HINTpublic void init()
AbstractConfigurationAwaresuper.init(Configuration).init in class AbstractConfigurationAwarepublic Set<ConfigurationKey> getConfigurationKeys()
public void invalidateMemberCache(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 © 2017. All rights reserved.