Top Description Inners Methods
org.easymock.bytebuddy.dynamic.scaffold

public Interface FieldRegistry

Known Direct Implementers
org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Default
Imports
org.easymock.bytebuddy.build.HashCodeAndEqualsPlugin, org.easymock.bytebuddy.description.field.FieldDescription, org.easymock.bytebuddy.description.type.TypeDescription, org.easymock.bytebuddy.dynamic.Transformer, org.easymock.bytebuddy.implementation.attribute.FieldAttributeAppender, org.easymock.bytebuddy.matcher.ElementMatcher, .LatentMatcher, org.easymock.bytebuddy.utility.nullability.MaybeNull, java.util.*

A field registry represents an extendable collection of fields which are identified by their names that are mapped to a given org.easymock.bytebuddy.implementation.attribute.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 org.easymock.bytebuddy.dynamic.scaffold.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 and Inner Type Summary

Modifier and TypeClass and Description
public static interface
FieldRegistry.Compiled

Represents a compiled field registry.

public static class
FieldRegistry.Default

An immutable default implementation of a field registry.

Method Summary

Modifier and TypeMethod and Description
public FieldRegistry.Compiled

Returns:

A prepared field registry.
compile
(TypeDescription
The instrumented type.
instrumentedType
)

Prepares the field registry for a given instrumented type.

public FieldRegistry

Returns:

An adapted version of this method registry.
prepend
(LatentMatcher<? super FieldDescription>
The matcher to identify any field that this definition concerns.
matcher
,
FieldAttributeAppender.Factory
The field attribute appender factory to apply on any matched field.
fieldAttributeAppenderFactory
,
Object
The default value to write to the field or null if no default value is to be set for the field.
defaultValue
,
Transformer<FieldDescription>
The field transformer to apply to any matched field.
transformer
)

Prepends the given field definition to this field registry, i.e. this configuration is applied first.

Method Detail

compileback to summary
public FieldRegistry.Compiled compile(TypeDescription instrumentedType)

Prepares the field registry for a given instrumented type.

Parameters
instrumentedType:TypeDescription

The instrumented type.

Returns:FieldRegistry.Compiled

A prepared field registry.

prependback to summary
public FieldRegistry prepend(LatentMatcher<? super FieldDescription> matcher, FieldAttributeAppender.Factory fieldAttributeAppenderFactory, Object defaultValue, Transformer<FieldDescription> transformer)

Prepends the given field definition to this field registry, i.e. this configuration is applied first.

Parameters
matcher:LatentMatcher<? super FieldDescription>

The matcher to identify any field that this definition concerns.

fieldAttributeAppenderFactory:FieldAttributeAppender.Factory

The field attribute appender factory to apply on any matched field.

defaultValue:Object

The default value to write to the field or null if no default value is to be set for the field.

transformer:Transformer<FieldDescription>

The field transformer to apply to any matched field.

Returns:FieldRegistry

An adapted version of this method registry.

org.easymock.bytebuddy.dynamic.scaffold back to summary

public Interface FieldRegistry.Compiled

extends FieldPool
Known Direct Implementers
org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Compiled.NoOp, org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Default.Compiled

Represents a compiled field registry.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
FieldRegistry.Compiled.NoOp

A no-op field registry that does not register annotations for any field.

Method Summary

Inherited from org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool:
target
org.easymock.bytebuddy.dynamic.scaffold back to summary

public final Enum FieldRegistry.Compiled.NoOp

extends Enum<FieldRegistry.Compiled.NoOp>
implements Compiled
Class Inheritance
All Implemented Interfaces
org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Compiled, org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool

A no-op field registry that does not register annotations for any field.

Field Summary

Modifier and TypeField and Description
public static final FieldRegistry.Compiled.NoOp
INSTANCE

The singleton instance.

Constructor Summary

AccessConstructor and Description
private
NoOp()

Method Summary

Modifier and TypeMethod and Description
public TypeWriter.FieldPool.Record
target(FieldDescription
The field being processed.
fieldDescription
)

Implements org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool.target.

Looks up a handler entry for a given field.
public static FieldRegistry.Compiled.NoOp
public static FieldRegistry.Compiled.NoOp[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final FieldRegistry.Compiled.NoOp INSTANCE

The singleton instance.

Constructor Detail

NoOpback to summary
private NoOp()

Method Detail

targetback to summary
public TypeWriter.FieldPool.Record target(FieldDescription fieldDescription)

Implements org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool.target.

Doc from org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool.target.

Looks up a handler entry for a given field.

Parameters
fieldDescription:FieldDescription

The field being processed.

Returns:TypeWriter.FieldPool.Record

A handler entry for the given field.

valueOfback to summary
public static FieldRegistry.Compiled.NoOp valueOf(String name)
valuesback to summary
public static FieldRegistry.Compiled.NoOp[] values()
org.easymock.bytebuddy.dynamic.scaffold back to summary

public Class FieldRegistry.Default

extends Object
implements FieldRegistry
Class Inheritance
  • java.lang.Object
  • org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Default
All Implemented Interfaces
org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry
Annotations
@Enhance

An immutable default implementation of a field registry.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
FieldRegistry.Default.Compiled

A compiled default field registry.

protected static class
FieldRegistry.Default.Entry

An entry of the default field registry.

Field Summary

Modifier and TypeField and Description
private final List<FieldRegistry.Default.Entry>
entries

This registries entries.

Constructor Summary

AccessConstructor and Description
public
Default()

Creates a new empty default field registry.

private
Default(List<FieldRegistry.Default.Entry>
The entries of the field registry.
entries
)

Creates a new default field registry.

Method Summary

Modifier and TypeMethod and Description
public FieldRegistry.Compiled
compile(TypeDescription
The instrumented type.
instrumentedType
)

Implements org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.compile.

Prepares the field registry for a given instrumented type.
public FieldRegistry
prepend(LatentMatcher<? super FieldDescription>
The matcher to identify any field that this definition concerns.
matcher
,
FieldAttributeAppender.Factory
The field attribute appender factory to apply on any matched field.
fieldAttributeAppenderFactory
,
Object
The default value to write to the field or null if no default value is to be set for the field.
defaultValue
,
Transformer<FieldDescription>
The field transformer to apply to any matched field.
transformer
)

Implements org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.prepend.

Prepends the given field definition to this field registry, i.e. this configuration is applied first.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entriesback to summary
private final List<FieldRegistry.Default.Entry> entries

This registries entries.

Constructor Detail

Defaultback to summary
public Default()

Creates a new empty default field registry.

Defaultback to summary
private Default(List<FieldRegistry.Default.Entry> entries)

Creates a new default field registry.

Parameters
entries:List<FieldRegistry.Default.Entry>

The entries of the field registry.

Method Detail

compileback to summary
public FieldRegistry.Compiled compile(TypeDescription instrumentedType)

Implements org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.compile.

Doc from org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.compile.

Prepares the field registry for a given instrumented type.

Parameters
instrumentedType:TypeDescription

The instrumented type.

Returns:FieldRegistry.Compiled

A prepared field registry.

prependback to summary
public FieldRegistry prepend(LatentMatcher<? super FieldDescription> matcher, FieldAttributeAppender.Factory fieldAttributeAppenderFactory, Object defaultValue, Transformer<FieldDescription> transformer)

Implements org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.prepend.

Doc from org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.prepend.

Prepends the given field definition to this field registry, i.e. this configuration is applied first.

Parameters
matcher:LatentMatcher<? super FieldDescription>

The matcher to identify any field that this definition concerns.

fieldAttributeAppenderFactory:FieldAttributeAppender.Factory

The field attribute appender factory to apply on any matched field.

defaultValue:Object

The default value to write to the field or null if no default value is to be set for the field.

transformer:Transformer<FieldDescription>

The field transformer to apply to any matched field.

Returns:FieldRegistry

An adapted version of this method registry.

org.easymock.bytebuddy.dynamic.scaffold back to summary

protected Class FieldRegistry.Default.Compiled

extends Object
implements Compiled
Class Inheritance
  • java.lang.Object
  • org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Default.Compiled
All Implemented Interfaces
org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Compiled, org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool
Annotations
@Enhance

A compiled default field registry.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
FieldRegistry.Default.Compiled.Entry

An entry of a compiled field registry.

Field Summary

Modifier and TypeField and Description
private final List<FieldRegistry.Default.Compiled.Entry>
entries

The entries of this compiled field registry.

private final TypeDescription
instrumentedType

The instrumented type for which this registry was compiled for.

Constructor Summary

AccessConstructor and Description
protected
Compiled(TypeDescription
The instrumented type for which this registry was compiled for.
instrumentedType
,
List<FieldRegistry.Default.Compiled.Entry>
The entries of this compiled field registry.
entries
)

Creates a new compiled field registry.

Method Summary

Modifier and TypeMethod and Description
public TypeWriter.FieldPool.Record
target(FieldDescription
The field being processed.
fieldDescription
)

Implements org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool.target.

Looks up a handler entry for a given field.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entriesback to summary
private final List<FieldRegistry.Default.Compiled.Entry> entries

The entries of this compiled field registry.

instrumentedTypeback to summary
private final TypeDescription instrumentedType

The instrumented type for which this registry was compiled for.

Constructor Detail

Compiledback to summary
protected Compiled(TypeDescription instrumentedType, List<FieldRegistry.Default.Compiled.Entry> entries)

Creates a new compiled field registry.

Parameters
instrumentedType:TypeDescription

The instrumented type for which this registry was compiled for.

entries:List<FieldRegistry.Default.Compiled.Entry>

The entries of this compiled field registry.

Method Detail

targetback to summary
public TypeWriter.FieldPool.Record target(FieldDescription fieldDescription)

Implements org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool.target.

Doc from org.easymock.bytebuddy.dynamic.scaffold.TypeWriter.FieldPool.target.

Looks up a handler entry for a given field.

Parameters
fieldDescription:FieldDescription

The field being processed.

Returns:TypeWriter.FieldPool.Record

A handler entry for the given field.

org.easymock.bytebuddy.dynamic.scaffold back to summary

protected Class FieldRegistry.Default.Compiled.Entry

extends Object
implements ElementMatcher<FieldDescription>
Class Inheritance
  • java.lang.Object
  • org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Default.Compiled.Entry
All Implemented Interfaces
org.easymock.bytebuddy.matcher.ElementMatcher
Annotations
@Enhance

An entry of a compiled field registry.

Field Summary

Modifier and TypeField and Description
private final Object
defaultValue

The default value to write to the field or null if no default value is to be set for the field.

private final FieldAttributeAppender
fieldAttributeAppender

The field attribute appender to apply on any matched field.

private final ElementMatcher<? super FieldDescription>
matcher

The matcher to identify any field that this definition concerns.

private final Transformer<FieldDescription>
transformer

The field transformer to apply to any matched field.

Constructor Summary

AccessConstructor and Description
protected
Entry(ElementMatcher<? super FieldDescription>
The matcher to identify any field that this definition concerns.
matcher
,
FieldAttributeAppender
The field attribute appender to apply on any matched field.
fieldAttributeAppender
,
Object
The default value to write to the field or null if no default value is to be set for the field.
defaultValue
,
Transformer<FieldDescription>
The field transformer to apply to any matched field.
transformer
)

Creates a new entry.

Method Summary

Modifier and TypeMethod and Description
protected TypeWriter.FieldPool.Record

Returns:

A record representing the binding of this entry to the provided field.
bind
(TypeDescription
The instrumented type for which this entry applies.
instrumentedType
,
FieldDescription
The field description to be bound to this entry.
fieldDescription
)

Binds this entry to the provided field description.

public boolean
matches(FieldDescription
The instance to be matched or null.
target
)

Implements org.easymock.bytebuddy.matcher.ElementMatcher.matches.

Matches a target against this element matcher.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultValueback to summary
private final Object defaultValue

The default value to write to the field or null if no default value is to be set for the field.

Annotations
@MaybeNull
@ValueHandling:REVERSE_NULLABILITY
fieldAttributeAppenderback to summary
private final FieldAttributeAppender fieldAttributeAppender

The field attribute appender to apply on any matched field.

matcherback to summary
private final ElementMatcher<? super FieldDescription> matcher

The matcher to identify any field that this definition concerns.

transformerback to summary
private final Transformer<FieldDescription> transformer

The field transformer to apply to any matched field.

Constructor Detail

Entryback to summary
protected Entry(ElementMatcher<? super FieldDescription> matcher, FieldAttributeAppender fieldAttributeAppender, Object defaultValue, Transformer<FieldDescription> transformer)

Creates a new entry.

Parameters
matcher:ElementMatcher<? super FieldDescription>

The matcher to identify any field that this definition concerns.

fieldAttributeAppender:FieldAttributeAppender

The field attribute appender to apply on any matched field.

defaultValue:Object

The default value to write to the field or null if no default value is to be set for the field.

transformer:Transformer<FieldDescription>

The field transformer to apply to any matched field.

Method Detail

bindback to summary
protected TypeWriter.FieldPool.Record bind(TypeDescription instrumentedType, FieldDescription fieldDescription)

Binds this entry to the provided field description.

Parameters
instrumentedType:TypeDescription

The instrumented type for which this entry applies.

fieldDescription:FieldDescription

The field description to be bound to this entry.

Returns:TypeWriter.FieldPool.Record

A record representing the binding of this entry to the provided field.

matchesback to summary
public boolean matches(FieldDescription target)

Implements org.easymock.bytebuddy.matcher.ElementMatcher.matches.

Doc from org.easymock.bytebuddy.matcher.ElementMatcher.matches.

Matches a target against this element matcher.

Parameters
target:FieldDescription

The instance to be matched or null.

Returns:boolean

true if the given element is matched by this matcher or false otherwise.

org.easymock.bytebuddy.dynamic.scaffold back to summary

protected Class FieldRegistry.Default.Entry

extends Object
implements LatentMatcher<FieldDescription>
Class Inheritance
  • java.lang.Object
  • org.easymock.bytebuddy.dynamic.scaffold.FieldRegistry.Default.Entry
All Implemented Interfaces
org.easymock.bytebuddy.matcher.LatentMatcher
Annotations
@Enhance

An entry of the default field registry.

Field Summary

Modifier and TypeField and Description
private final Object
defaultValue

The default value to write to the field or null if no default value is to be set for the field.

private final FieldAttributeAppender.Factory
fieldAttributeAppenderFactory

The field attribute appender factory to apply on any matched field.

private final LatentMatcher<? super FieldDescription>
matcher

The matcher to identify any field that this definition concerns.

private final Transformer<FieldDescription>
transformer

The field transformer to apply to any matched field.

Constructor Summary

AccessConstructor and Description
protected
Entry(LatentMatcher<? super FieldDescription>
The matcher to identify any field that this definition concerns.
matcher
,
FieldAttributeAppender.Factory
The field attribute appender factory to apply on any matched field.
fieldAttributeAppenderFactory
,
Object
The default value to write to the field or null if no default value is to be set for the field.
defaultValue
,
Transformer<FieldDescription>
The field transformer to apply to any matched field.
transformer
)

Creates a new entry.

Method Summary

Modifier and TypeMethod and Description
protected Object

Returns:

The default value to write to the field or null if no default value is to be set for the field.
getDefaultValue
()

Returns the default value to write to the field or null if no default value is to be set for the field.

protected FieldAttributeAppender.Factory

Returns:

The field attribute appender factory to apply on any matched field.
getFieldAttributeAppenderFactory
()

Returns the field attribute appender factory to apply on any matched field.

protected Transformer<FieldDescription>

Returns:

The field transformer to apply to any matched field.
getTransformer
()

Returns the field transformer to apply to any matched field.

public ElementMatcher<? super FieldDescription>
resolve(TypeDescription
The type description for which the represented matcher should be resolved.
typeDescription
)

Implements org.easymock.bytebuddy.matcher.LatentMatcher.resolve.

Resolves the element matcher this instance represents for the supplied type description.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultValueback to summary
private final Object defaultValue

The default value to write to the field or null if no default value is to be set for the field.

Annotations
@MaybeNull
@ValueHandling:REVERSE_NULLABILITY
fieldAttributeAppenderFactoryback to summary
private final FieldAttributeAppender.Factory fieldAttributeAppenderFactory

The field attribute appender factory to apply on any matched field.

matcherback to summary
private final LatentMatcher<? super FieldDescription> matcher

The matcher to identify any field that this definition concerns.

transformerback to summary
private final Transformer<FieldDescription> transformer

The field transformer to apply to any matched field.

Constructor Detail

Entryback to summary
protected Entry(LatentMatcher<? super FieldDescription> matcher, FieldAttributeAppender.Factory fieldAttributeAppenderFactory, Object defaultValue, Transformer<FieldDescription> transformer)

Creates a new entry.

Parameters
matcher:LatentMatcher<? super FieldDescription>

The matcher to identify any field that this definition concerns.

fieldAttributeAppenderFactory:FieldAttributeAppender.Factory

The field attribute appender factory to apply on any matched field.

defaultValue:Object

The default value to write to the field or null if no default value is to be set for the field.

transformer:Transformer<FieldDescription>

The field transformer to apply to any matched field.

Method Detail

getDefaultValueback to summary
protected Object getDefaultValue()

Returns the default value to write to the field or null if no default value is to be set for the field.

Returns:Object

The default value to write to the field or null if no default value is to be set for the field.

Annotations
@MaybeNull
getFieldAttributeAppenderFactoryback to summary
protected FieldAttributeAppender.Factory getFieldAttributeAppenderFactory()

Returns the field attribute appender factory to apply on any matched field.

Returns:FieldAttributeAppender.Factory

The field attribute appender factory to apply on any matched field.

getTransformerback to summary
protected Transformer<FieldDescription> getTransformer()

Returns the field transformer to apply to any matched field.

Returns:Transformer<FieldDescription>

The field transformer to apply to any matched field.

resolveback to summary
public ElementMatcher<? super FieldDescription> resolve(TypeDescription typeDescription)

Implements org.easymock.bytebuddy.matcher.LatentMatcher.resolve.

Doc from org.easymock.bytebuddy.matcher.LatentMatcher.resolve.

Resolves the element matcher this instance represents for the supplied type description.

Parameters
typeDescription:TypeDescription

The type description for which the represented matcher should be resolved.

Returns:ElementMatcher<? super FieldDescription>

An ElementMatcher that represents this matcher's resolved form.