Package net.bytebuddy.dynamic.scaffold
Interface FieldRegistry
-
- All Known Implementing Classes:
FieldRegistry.Default
public interface FieldRegistry
A field registry represents an extendable collection of fields which are identified by their names that are mapped to a givenFieldAttributeAppender
. Fields can be uniquely identified by their name for a given type since fields are never inherited.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
FieldRegistry.Compiled
Represents a compiled field registry.static class
FieldRegistry.Default
An immutable default implementation of a field registry.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FieldRegistry.Compiled
compile(TypeDescription instrumentedType)
Prepares the field registry for a given instrumented type.FieldRegistry
prepend(LatentMatcher<? super FieldDescription> matcher, FieldAttributeAppender.Factory fieldAttributeAppenderFactory, java.lang.Object defaultValue, Transformer<FieldDescription> transformer)
Prepends the given field definition to this field registry, i.e.
-
-
-
Method Detail
-
prepend
FieldRegistry prepend(LatentMatcher<? super FieldDescription> matcher, FieldAttributeAppender.Factory fieldAttributeAppenderFactory, java.lang.Object defaultValue, Transformer<FieldDescription> transformer)
Prepends the given field definition to this field registry, i.e. this configuration is applied first.- Parameters:
matcher
- The matcher to identify any field that this definition concerns.fieldAttributeAppenderFactory
- The field attribute appender factory to apply on any matched field.defaultValue
- The default value to write to the field ornull
if no default value is to be set for the field.transformer
- The field transformer to apply to any matched field.- Returns:
- An adapted version of this method registry.
-
compile
FieldRegistry.Compiled compile(TypeDescription instrumentedType)
Prepares the field registry for a given instrumented type.- Parameters:
instrumentedType
- The instrumented type.- Returns:
- A prepared field registry.
-
-