Enum PrimitiveNarrowingDelegate
- java.lang.Object
-
- java.lang.Enum<PrimitiveNarrowingDelegate>
-
- net.bytebuddy.implementation.bytecode.assign.primitive.PrimitiveNarrowingDelegate
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<PrimitiveNarrowingDelegate>
public enum PrimitiveNarrowingDelegate extends java.lang.Enum<PrimitiveNarrowingDelegate>
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 Classes Modifier and Type Class Description protected static classPrimitiveNarrowingDelegate.NarrowingStackManipulationA stack manipulation that narrows a primitive type into a smaller primitive type.
-
Enum Constant Summary
Enum Constants Enum Constant Description BOOLEANThe narrowing delegate forbooleanvalues.BYTEThe narrowing delegate forbytevalues.CHARACTERThe narrowing delegate forcharvalues.DOUBLEThe narrowing delegate fordoublevalues.FLOATThe narrowing delegate forfloatvalues.INTEGERThe narrowing delegate forintvalues.LONGThe narrowing delegate forlongvalues.SHORTThe narrowing delegate forshortvalues.
-
Field Summary
Fields Modifier and Type Field Description private StackManipulationtoBooleanStackManipulationA stack manipulation that narrows the type that is represented by this instance to aboolean.private StackManipulationtoByteStackManipulationA stack manipulation that narrows the type that is represented by this instance to abyte.private StackManipulationtoCharacterStackManipulationA stack manipulation that narrows the type that is represented by this instance to achar.private StackManipulationtoDoubleStackManipulationA stack manipulation that narrows the type that is represented by this instance to adouble.private StackManipulationtoFloatStackManipulationA stack manipulation that narrows the type that is represented by this instance to afloat.private StackManipulationtoIntegerStackManipulationA stack manipulation that narrows the type that is represented by this instance to aint.private StackManipulationtoLongStackManipulationA stack manipulation that narrows the type that is represented by this instance to along.private StackManipulationtoShortStackManipulationA stack manipulation that narrows the type that is represented by this instance to ashort.
-
Constructor Summary
Constructors Modifier Constructor Description privatePrimitiveNarrowingDelegate(StackManipulation toBooleanStackManipulation, StackManipulation toByteStackManipulation, StackManipulation toShortStackManipulation, StackManipulation toCharacterStackManipulation, StackManipulation toIntegerStackManipulation, StackManipulation toLongStackManipulation, StackManipulation toFloatStackManipulation, StackManipulation toDoubleStackManipulation)Creates a new primitive narrowing delegate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PrimitiveNarrowingDelegateforPrimitive(TypeDefinition typeDefinition)Locates the delegate that is capable of narrowing the given type into another type.StackManipulationnarrowTo(TypeDefinition typeDefinition)Attempts to narrow the represented type into another type.static PrimitiveNarrowingDelegatevalueOf(java.lang.String name)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 Detail
-
BOOLEAN
public static final PrimitiveNarrowingDelegate BOOLEAN
The narrowing delegate forbooleanvalues.
-
BYTE
public static final PrimitiveNarrowingDelegate BYTE
The narrowing delegate forbytevalues.
-
SHORT
public static final PrimitiveNarrowingDelegate SHORT
The narrowing delegate forshortvalues.
-
CHARACTER
public static final PrimitiveNarrowingDelegate CHARACTER
The narrowing delegate forcharvalues.
-
INTEGER
public static final PrimitiveNarrowingDelegate INTEGER
The narrowing delegate forintvalues.
-
LONG
public static final PrimitiveNarrowingDelegate LONG
The narrowing delegate forlongvalues.
-
FLOAT
public static final PrimitiveNarrowingDelegate FLOAT
The narrowing delegate forfloatvalues.
-
DOUBLE
public static final PrimitiveNarrowingDelegate DOUBLE
The narrowing delegate fordoublevalues.
-
-
Field Detail
-
toBooleanStackManipulation
private final StackManipulation toBooleanStackManipulation
A stack manipulation that narrows the type that is represented by this instance to aboolean.
-
toByteStackManipulation
private final StackManipulation toByteStackManipulation
A stack manipulation that narrows the type that is represented by this instance to abyte.
-
toShortStackManipulation
private final StackManipulation toShortStackManipulation
A stack manipulation that narrows the type that is represented by this instance to ashort.
-
toCharacterStackManipulation
private final StackManipulation toCharacterStackManipulation
A stack manipulation that narrows the type that is represented by this instance to achar.
-
toIntegerStackManipulation
private final StackManipulation toIntegerStackManipulation
A stack manipulation that narrows the type that is represented by this instance to aint.
-
toLongStackManipulation
private final StackManipulation toLongStackManipulation
A stack manipulation that narrows the type that is represented by this instance to along.
-
toFloatStackManipulation
private final StackManipulation toFloatStackManipulation
A stack manipulation that narrows the type that is represented by this instance to afloat.
-
toDoubleStackManipulation
private final StackManipulation toDoubleStackManipulation
A stack manipulation that narrows the type that is represented by this instance to adouble.
-
-
Constructor Detail
-
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 Detail
-
values
public static PrimitiveNarrowingDelegate[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PrimitiveNarrowingDelegate c : PrimitiveNarrowingDelegate.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PrimitiveNarrowingDelegate valueOf(java.lang.String name)
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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
forPrimitive
public static PrimitiveNarrowingDelegate forPrimitive(TypeDefinition typeDefinition)
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
public StackManipulation narrowTo(TypeDefinition typeDefinition)
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.
-
-