Enum PrimitiveNarrowingDelegate
java.lang.Object
java.lang.Enum<PrimitiveNarrowingDelegate>
net.bytebuddy.implementation.bytecode.assign.primitive.PrimitiveNarrowingDelegate
- All Implemented Interfaces:
Serializable
,Comparable<PrimitiveNarrowingDelegate>
,java.lang.constant.Constable
This delegate is responsible for narrowing a primitive type to represent a smaller primitive type. The
rules for this narrowing are equivalent to those in the JLS.
This class also includes the byte-to-char conversion in widening and narrowing primitive conversions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A stack manipulation that narrows a primitive type into a smaller primitive type.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe narrowing delegate forboolean
values.The narrowing delegate forbyte
values.The narrowing delegate forchar
values.The narrowing delegate fordouble
values.The narrowing delegate forfloat
values.The narrowing delegate forint
values.The narrowing delegate forlong
values.The narrowing delegate forshort
values. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StackManipulation
A stack manipulation that narrows the type that is represented by this instance to aboolean
.private final StackManipulation
A stack manipulation that narrows the type that is represented by this instance to abyte
.private final StackManipulation
A stack manipulation that narrows the type that is represented by this instance to achar
.private final StackManipulation
A stack manipulation that narrows the type that is represented by this instance to adouble
.private final StackManipulation
A stack manipulation that narrows the type that is represented by this instance to afloat
.private final StackManipulation
A stack manipulation that narrows the type that is represented by this instance to aint
.private final StackManipulation
A stack manipulation that narrows the type that is represented by this instance to along
.private final StackManipulation
A stack manipulation that narrows the type that is represented by this instance to ashort
. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
PrimitiveNarrowingDelegate
(StackManipulation toBooleanStackManipulation, StackManipulation toByteStackManipulation, StackManipulation toShortStackManipulation, StackManipulation toCharacterStackManipulation, StackManipulation toIntegerStackManipulation, StackManipulation toLongStackManipulation, StackManipulation toFloatStackManipulation, StackManipulation toDoubleStackManipulation) Creates a new primitive narrowing delegate. -
Method Summary
Modifier and TypeMethodDescriptionstatic PrimitiveNarrowingDelegate
forPrimitive
(TypeDefinition typeDefinition) Locates the delegate that is capable of narrowing the given type into another type.narrowTo
(TypeDefinition typeDefinition) Attempts to narrow the represented type into another type.static PrimitiveNarrowingDelegate
Returns the enum constant of this type with the specified name.static PrimitiveNarrowingDelegate[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
BOOLEAN
The narrowing delegate forboolean
values. -
BYTE
The narrowing delegate forbyte
values. -
SHORT
The narrowing delegate forshort
values. -
CHARACTER
The narrowing delegate forchar
values. -
INTEGER
The narrowing delegate forint
values. -
LONG
The narrowing delegate forlong
values. -
FLOAT
The narrowing delegate forfloat
values. -
DOUBLE
The narrowing delegate fordouble
values.
-
-
Field Details
-
toBooleanStackManipulation
A stack manipulation that narrows the type that is represented by this instance to aboolean
. -
toByteStackManipulation
A stack manipulation that narrows the type that is represented by this instance to abyte
. -
toShortStackManipulation
A stack manipulation that narrows the type that is represented by this instance to ashort
. -
toCharacterStackManipulation
A stack manipulation that narrows the type that is represented by this instance to achar
. -
toIntegerStackManipulation
A stack manipulation that narrows the type that is represented by this instance to aint
. -
toLongStackManipulation
A stack manipulation that narrows the type that is represented by this instance to along
. -
toFloatStackManipulation
A stack manipulation that narrows the type that is represented by this instance to afloat
. -
toDoubleStackManipulation
A stack manipulation that narrows the type that is represented by this instance to adouble
.
-
-
Constructor Details
-
PrimitiveNarrowingDelegate
private PrimitiveNarrowingDelegate(StackManipulation toBooleanStackManipulation, StackManipulation toByteStackManipulation, StackManipulation toShortStackManipulation, StackManipulation toCharacterStackManipulation, StackManipulation toIntegerStackManipulation, StackManipulation toLongStackManipulation, StackManipulation toFloatStackManipulation, StackManipulation toDoubleStackManipulation) Creates a new primitive narrowing delegate.- Parameters:
toBooleanStackManipulation
- A stack manipulation that narrows the type that is represented by this instance to aboolean
.toByteStackManipulation
- A stack manipulation that narrows the type that is represented by this instance to abyte
.toShortStackManipulation
- A stack manipulation that narrows the type that is represented by this instance to ashort
.toCharacterStackManipulation
- A stack manipulation that narrows the type that is represented by this instance to achar
.toIntegerStackManipulation
- A stack manipulation that narrows the type that is represented by this instance to aint
.toLongStackManipulation
- A stack manipulation that narrows the type that is represented by this instance to along
.toFloatStackManipulation
- A stack manipulation that narrows the type that is represented by this instance to afloat
.toDoubleStackManipulation
- A stack manipulation that narrows the type that is represented by this instance to adouble
.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
forPrimitive
Locates the delegate that is capable of narrowing the given type into another type.- Parameters:
typeDefinition
- A non-void primitive type that is to be narrowed into another type.- Returns:
- A delegate for the given type.
-
narrowTo
Attempts to narrow the represented type into another type.- Parameters:
typeDefinition
- A non-void primitive type that is the expected result of the narrowing operation.- Returns:
- A narrowing instruction or an illegal stack manipulation if such narrowing is not legitimate.
-