public interface FieldRegistry
FieldAttributeAppender
. Fields
can be uniquely identified by their name for a given type since fields are never inherited.
This registry is the counterpart of a
MethodRegistry
.
However, a field registry is implemented simpler since it does not have to deal with complex signatures or
inheritance. For the sake of consistency, the field registry follows however a similar pattern without introducing
unnecessary complexity.Modifier and Type | Interface and Description |
---|---|
static interface |
FieldRegistry.Compiled
Represents a compiled field registry.
|
static class |
FieldRegistry.Default
An immutable default implementation of a field registry.
|
static interface |
FieldRegistry.LatentFieldMatcher
A simple matcher for a field where fields can be uniquely identified by their identifier for a given type.
|
Modifier and Type | Method and Description |
---|---|
FieldRegistry.Compiled |
compile(TypeDescription instrumentedType,
TypeWriter.FieldPool.Entry fallback)
Once all entries for a field registry were registered, a field registry can be compiled in order to allow the
retrieval of
FieldAttributeAppender s for
known fields. |
FieldRegistry |
include(FieldRegistry.LatentFieldMatcher latentFieldMatcher,
FieldAttributeAppender.Factory attributeAppenderFactory,
Object defaultValue)
Creates a new field registry with the given attribute appender registered for the supplied field matcher.
|
FieldRegistry include(FieldRegistry.LatentFieldMatcher latentFieldMatcher, FieldAttributeAppender.Factory attributeAppenderFactory, Object defaultValue)
latentFieldMatcher
- The field matcher uniquely identifying the field to be registered.attributeAppenderFactory
- The field attribute appender factory to be registered for this field.defaultValue
- The field's default value or null
if no such default value is set.FieldRegistry.Compiled compile(TypeDescription instrumentedType, TypeWriter.FieldPool.Entry fallback)
FieldAttributeAppender
s for
known fields. Additionally, a fallback attribute appender is to be supplied which is returned if a requested
field cannot is not known to the compiled field registry.
If a field name is already registered, an exception will be thrown.
instrumentedType
- The instrumented type for which this field registry is to be compiled.fallback
- A fallback entry that serves as a fallback for non-registered fields.Copyright © 2014. All rights reserved.