Enum PrimitiveBoxingDelegate

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<PrimitiveBoxingDelegate>

    public enum PrimitiveBoxingDelegate
    extends java.lang.Enum<PrimitiveBoxingDelegate>
    This delegate is responsible for boxing a primitive types to their wrapper equivalents.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      BOOLEAN
      The boxing delegate for boolean values.
      BYTE
      The boxing delegate for byte values.
      CHARACTER
      The boxing delegate for char values.
      DOUBLE
      The boxing delegate for double values.
      FLOAT
      The boxing delegate for float values.
      INTEGER
      The boxing delegate for int values.
      LONG
      The boxing delegate for long values.
      SHORT
      The boxing delegate for short values.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String boxingMethodDescriptor
      The descriptor of the method for boxing a primitive value as its wrapper type.
      private java.lang.String boxingMethodName
      The name of the method for boxing a primitive value as its wrapper type.
      private StackManipulation.Size size
      The size decrease after a primitive type was wrapped.
      private TypeDescription wrapperType
      A description of a wrapper type.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PrimitiveBoxingDelegate​(java.lang.Class<?> wrapperType, StackSize sizeDifference, java.lang.String boxingMethodName, java.lang.String boxingMethodDescriptor)
      Creates a new primitive boxing delegate.
    • Field Detail

      • wrapperType

        private final TypeDescription wrapperType
        A description of a wrapper type.
      • boxingMethodName

        private final java.lang.String boxingMethodName
        The name of the method for boxing a primitive value as its wrapper type.
      • boxingMethodDescriptor

        private final java.lang.String boxingMethodDescriptor
        The descriptor of the method for boxing a primitive value as its wrapper type.
    • Constructor Detail

      • PrimitiveBoxingDelegate

        private PrimitiveBoxingDelegate​(java.lang.Class<?> wrapperType,
                                        StackSize sizeDifference,
                                        java.lang.String boxingMethodName,
                                        java.lang.String boxingMethodDescriptor)
        Creates a new primitive boxing delegate.
        Parameters:
        wrapperType - A description of a wrapper type.
        sizeDifference - The size difference between a primitive type and its wrapper type.
        boxingMethodName - The name of the method for boxing a primitive value as its wrapper type.
        boxingMethodDescriptor - The descriptor of the method for boxing a primitive value as its wrapper type.
    • Method Detail

      • values

        public static PrimitiveBoxingDelegate[] 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 (PrimitiveBoxingDelegate c : PrimitiveBoxingDelegate.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static PrimitiveBoxingDelegate 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 name
        java.lang.NullPointerException - if the argument is null
      • forPrimitive

        public static PrimitiveBoxingDelegate forPrimitive​(TypeDefinition typeDefinition)
        Locates a boxing delegate for a given primitive type.
        Parameters:
        typeDefinition - A non-void primitive type.
        Returns:
        A delegate capable of boxing the given primitive type.
      • assignBoxedTo

        public StackManipulation assignBoxedTo​(TypeDescription.Generic target,
                                               Assigner chainedAssigner,
                                               Assigner.Typing typing)
        Creates a stack manipulation that boxes the represented primitive type and applies a chained assignment to the result of this boxing operation.
        Parameters:
        target - The type that is target of the assignment operation.
        chainedAssigner - The assigner that is to be used to perform the chained assignment.
        typing - Determines if an assignment to an incompatible type should be enforced by a casting.
        Returns:
        A stack manipulation that represents the described assignment operation.