public class CachedReturnPlugin extends Plugin.ForElementMatcher
final fields. In this context, it is possible that
the method is executed multiple times by different threads but at the same time, this approach avoids a volatile field
declaration. For methods with a primitive return type, the type's default value is used to indicate that a method was not yet invoked.
For methods that return a reference type, null is used as an indicator. If a method returns such a value, this mechanism will
not work.| Modifier and Type | Class and Description |
|---|---|
protected static class |
CachedReturnPlugin.CacheFieldOffsetMapping
An offset mapping for the cached field.
|
static interface |
CachedReturnPlugin.Enhance
Indicates methods that should be cached, i.e.
|
Plugin.ForElementMatcherElementMatcher.Junction<S>| Constructor and Description |
|---|
CachedReturnPlugin()
Creates a plugin for caching method return values.
|
| Modifier and Type | Method and Description |
|---|---|
DynamicType.Builder<?> |
apply(DynamicType.Builder<?> builder,
TypeDescription typeDescription)
Applies this plugin.
|
matchespublic CachedReturnPlugin()
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription)
Pluginbuilder - The builder to use as a basis for the applied transformation.typeDescription - The type being transformed.Copyright © 2014–2018. All rights reserved.