Package net.bytebuddy.implementation
Class LoadedTypeInitializer.ForStaticField
- java.lang.Object
-
- net.bytebuddy.implementation.LoadedTypeInitializer.ForStaticField
-
- All Implemented Interfaces:
java.io.Serializable
,LoadedTypeInitializer
- Enclosing interface:
- LoadedTypeInitializer
public static class LoadedTypeInitializer.ForStaticField extends java.lang.Object implements LoadedTypeInitializer, java.io.Serializable
A type initializer for setting a value for a static field.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.LoadedTypeInitializer
LoadedTypeInitializer.Compound, LoadedTypeInitializer.ForStaticField, LoadedTypeInitializer.NoOp
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForStaticField(java.lang.String fieldName, java.lang.Object value)
Creates a newLoadedTypeInitializer
for setting a static field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isAlive()
Indicates if this initializer is alive and needs to be invoked.void
onLoad(java.lang.Class<?> type)
Callback that is invoked on the creation of an instrumented type.
-
-
-
Constructor Detail
-
ForStaticField
protected ForStaticField(java.lang.String fieldName, java.lang.Object value)
Creates a newLoadedTypeInitializer
for setting a static field.- Parameters:
fieldName
- the name of the field.value
- The value to be set.
-
-
Method Detail
-
onLoad
public void onLoad(java.lang.Class<?> type)
Description copied from interface:LoadedTypeInitializer
Callback that is invoked on the creation of an instrumented type. If the loaded type initializer is alive, this method should be implemented empty instead of throwing an exception.- Specified by:
onLoad
in interfaceLoadedTypeInitializer
- Parameters:
type
- The manifestation of the instrumented type.
-
isAlive
public boolean isAlive()
Description copied from interface:LoadedTypeInitializer
Indicates if this initializer is alive and needs to be invoked. This is only meant as a mark. A loaded type initializer that is not alive might still be called and must therefore not throw an exception but rather provide an empty implementation.- Specified by:
isAlive
in interfaceLoadedTypeInitializer
- Returns:
true
if this initializer is alive.
-
-