Top Description Inners Fields Constructors Methods
org.easymock.bytebuddy.implementation

public abstract Class FixedValue

extends Object
implements Implementation
Class Inheritance
All Implemented Interfaces
org.easymock.bytebuddy.implementation.Implementation, org.easymock.bytebuddy.dynamic.scaffold.InstrumentedType.Prepareable
Known Direct Subclasses
org.easymock.bytebuddy.implementation.FixedValue.ForOriginType, org.easymock.bytebuddy.implementation.FixedValue.ForThisValue, org.easymock.bytebuddy.implementation.FixedValue.ForArgument, org.easymock.bytebuddy.implementation.FixedValue.ForConstantValue, org.easymock.bytebuddy.implementation.FixedValue.ForValue
Annotations
@Enhance
Imports
org.easymock.bytebuddy.build.HashCodeAndEqualsPlugin, org.easymock.bytebuddy.description.field.FieldDescription, org.easymock.bytebuddy.description.method.MethodDescription, .ParameterDescription, org.easymock.bytebuddy.description.type.TypeDescription, org.easymock.bytebuddy.dynamic.scaffold.InstrumentedType, org.easymock.bytebuddy.implementation.bytecode.ByteCodeAppender, .StackManipulation, org.easymock.bytebuddy.implementation.bytecode.assign.Assigner, org.easymock.bytebuddy.implementation.bytecode.constant.*, org.easymock.bytebuddy.implementation.bytecode.member.FieldAccess, .MethodReturn, .MethodVariableAccess, org.easymock.bytebuddy.utility.ConstantValue, .JavaConstant, .RandomString, org.easymock.bytebuddy.jar.asm.MethodVisitor, .Opcodes

This implementation returns a fixed value for a method. Other than the org.easymock.bytebuddy.implementation.StubMethod implementation, this implementation allows to determine a specific value which must be assignable to the returning value of any instrumented method. Otherwise, an exception will be thrown.
See Also
FieldAccessor

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
FixedValue.AssignerConfigurable

Represents a fixed value implementation that is using a default assigner for attempting to assign the fixed value to the return type of the instrumented method.

protected static class
FixedValue.ForArgument

A fixed value implementation that returns a method's argument.

protected static class
FixedValue.ForConstantValue

A fixed value implementation that represents its fixed value as a constant pool value or a byte code instruction.

protected static enum
FixedValue.ForNullValue

A fixed value of null.

protected static class
FixedValue.ForOriginType

A fixed value that appends the origin type of the instrumented type.

protected static class
FixedValue.ForThisValue

A fixed value of this.

protected static class
FixedValue.ForValue

A fixed value implementation that represents its fixed value as a static field of the instrumented class.

Field Summary

Modifier and TypeField and Description
protected final Assigner
assigner

The assigner that is used for assigning the fixed value to a method's return type.

protected final Assigner.Typing
typing

Indicates if dynamic type castings should be attempted for incompatible assignments.

Constructor Summary

AccessConstructor and Description
protected
FixedValue(Assigner
The assigner to use for assigning the fixed value to the return type of the instrumented value.
assigner
,
Assigner.Typing
Indicates if dynamic type castings should be attempted for incompatible assignments.
typing
)

Creates a new fixed value implementation.

Method Summary

Modifier and TypeMethod and Description
protected ByteCodeAppender.Size

Returns:

A representation of the stack and variable array sized that are required for this implementation.
apply
(MethodVisitor
The method visitor to which the implementation is applied to.
methodVisitor
,
Implementation.Context
The implementation context for the given implementation.
implementationContext
,
MethodDescription
The instrumented method that is target of the implementation.
instrumentedMethod
,
TypeDescription.Generic
A description of the type of the fixed value that is loaded by the valueLoadingInstruction.
typeDescription
,
StackManipulation
A stack manipulation that represents the loading of the fixed value onto the operand stack.
stackManipulation
)

Blueprint method that for applying the actual implementation.

public static FixedValue.AssignerConfigurable

Returns:

An implementation of a method that returns the argument at the specified index.
argument
(int
The index of the argument to return.
index
)

Returns the argument at the specified index.

public static Implementation

Returns:

An implementation that returns null from a method.
nullValue
()

Returns a null value from an instrumented method.

public static FixedValue.AssignerConfigurable

Returns:

An implementation that returns the origin type of the current instrumented type.
originType
()

Returns the origin type from an instrumented method.

public static FixedValue.AssignerConfigurable

Returns:

An implementation for the given value.
reference
(Object
The fixed value to be returned by methods that are instrumented by this implementation.
value
)

Other than org.easymock.bytebuddy.implementation.FixedValue#value(Object), this function will create a fixed value implementation that will always defined a field in the instrumented class.

public static FixedValue.AssignerConfigurable

Returns:

An implementation for the given value.
reference
(Object
The fixed value to be returned by methods that are instrumented by this implementation.
value
,
String
The name of the field for storing the fixed value.
name
)

Other than org.easymock.bytebuddy.implementation.FixedValue#value(Object), this function will create a fixed value implementation that will always defined a field in the instrumented class.

public static FixedValue.AssignerConfigurable

Returns:

An implementation that returns this from a method.
self
()

Returns this from an instrumented method.

public static FixedValue.AssignerConfigurable

Returns:

An implementation for the given value.
value
(Object
The fixed value to return from the method.
value
)

Returns a fixed value from any intercepted method.

public static FixedValue.AssignerConfigurable

Returns:

An implementation for the given value.
value
(TypeDescription
The type to return from the method.
type
)

Returns the given type in form of a loaded type.

public static FixedValue.AssignerConfigurable

Returns:

An implementation for the given value.
value
(ConstantValue
The type to return from the method.
constant
)

Returns the loaded version of the given JavaConstant.

public static FixedValue.AssignerConfigurable

Returns:

An implementation for the given value.
value
(JavaConstant
The type to return from the method.
constant
)

Returns the loaded version of the given JavaConstant.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait