Top Description Fields Constructors Methods
net.bytebuddy.jar.asm

public final Class ConstantDynamic

extends Object
Class Inheritance
Imports
java.util.Arrays

A constant whose value is computed at runtime, with a bootstrap method.
Author
Remi Forax

Field Summary

Modifier and TypeField and Description
private final Handle
bootstrapMethod

The bootstrap method to use to compute the constant value at runtime.

private final Object[]
bootstrapMethodArguments

The arguments to pass to the bootstrap method, in order to compute the constant value at runtime.

private final String
descriptor

The constant type (must be a field descriptor).

private final String
name

The constant name (can be arbitrary).

Constructor Summary

AccessConstructor and Description
public
ConstantDynamic(final String
the constant name (can be arbitrary).
name
,
final String
the constant type (must be a field descriptor).
descriptor
,
final Handle
the bootstrap method to use to compute the constant value at runtime.
bootstrapMethod
,
final Object...
the arguments to pass to the bootstrap method, in order to compute the constant value at runtime.
bootstrapMethodArguments
)

Constructs a new ConstantDynamic.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(final Object
the reference object with which to compare.
object
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public Handle

Returns:

the bootstrap method used to compute the value of this constant.
getBootstrapMethod
()

Returns the bootstrap method used to compute the value of this constant.

public Object

Returns:

the argument passed to the bootstrap method, with the given index.
getBootstrapMethodArgument
(final int
an argument index, between 0 and getBootstrapMethodArgumentCount() (exclusive).
index
)

Returns an argument passed to the bootstrap method, in order to compute the value of this constant.

public int

Returns:

the number of arguments passed to the bootstrap method, in order to compute the value of this constant.
getBootstrapMethodArgumentCount
()

Returns the number of arguments passed to the bootstrap method, in order to compute the value of this constant.

pack-priv Object[]

Returns:

the arguments to pass to the bootstrap method, in order to compute the value of this constant.
getBootstrapMethodArgumentsUnsafe
()

Returns the arguments to pass to the bootstrap method, in order to compute the value of this constant.

public String

Returns:

the type of this constant, as a field descriptor.
getDescriptor
()

Returns the type of this constant.

public String

Returns:

the name of this constant.
getName
()

Returns the name of this constant.

public int

Returns:

the size of this constant, i.e., 2 for long and double, 1 otherwise.
getSize
()

Returns the size of this constant.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

bootstrapMethodback to summary
private final Handle bootstrapMethod

The bootstrap method to use to compute the constant value at runtime.

bootstrapMethodArgumentsback to summary
private final Object[] bootstrapMethodArguments

The arguments to pass to the bootstrap method, in order to compute the constant value at runtime.

descriptorback to summary
private final String descriptor

The constant type (must be a field descriptor).

nameback to summary
private final String name

The constant name (can be arbitrary).

Constructor Detail

ConstantDynamicback to summary
public ConstantDynamic(final String name, final String descriptor, final Handle bootstrapMethod, final Object... bootstrapMethodArguments)

Constructs a new ConstantDynamic.

Parameters
name:String

the constant name (can be arbitrary).

descriptor:String

the constant type (must be a field descriptor).

bootstrapMethod:Handle

the bootstrap method to use to compute the constant value at runtime.

bootstrapMethodArguments:Object[]

the arguments to pass to the bootstrap method, in order to compute the constant value at runtime.

Method Detail

equalsback to summary
public boolean equals(final Object object)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
object:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getBootstrapMethodback to summary
public Handle getBootstrapMethod()

Returns the bootstrap method used to compute the value of this constant.

Returns:Handle

the bootstrap method used to compute the value of this constant.

getBootstrapMethodArgumentback to summary
public Object getBootstrapMethodArgument(final int index)

Returns an argument passed to the bootstrap method, in order to compute the value of this constant.

Parameters
index:int

an argument index, between 0 and getBootstrapMethodArgumentCount() (exclusive).

Returns:Object

the argument passed to the bootstrap method, with the given index.

getBootstrapMethodArgumentCountback to summary
public int getBootstrapMethodArgumentCount()

Returns the number of arguments passed to the bootstrap method, in order to compute the value of this constant.

Returns:int

the number of arguments passed to the bootstrap method, in order to compute the value of this constant.

getBootstrapMethodArgumentsUnsafeback to summary
pack-priv Object[] getBootstrapMethodArgumentsUnsafe()

Returns the arguments to pass to the bootstrap method, in order to compute the value of this constant.

Warning

this array must not be modified, and must not be returned to the user.

Returns:Object[]

the arguments to pass to the bootstrap method, in order to compute the value of this constant.

getDescriptorback to summary
public String getDescriptor()

Returns the type of this constant.

Returns:String

the type of this constant, as a field descriptor.

getNameback to summary
public String getName()

Returns the name of this constant.

Returns:String

the name of this constant.

getSizeback to summary
public int getSize()

Returns the size of this constant.

Returns:int

the size of this constant, i.e., 2 for long and double, 1 otherwise.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override