Class ByteCachedClass


public class ByteCachedClass extends NumberCachedClass
Provides optimized reflection caching for byte and Byte. Coerces numeric arguments to byte values for type-safe method invocation. Optionally allows null values for the boxed Byte class variant.
  • Constructor Details

    • ByteCachedClass

      public ByteCachedClass(Class klazz, ClassInfo classInfo, boolean allowNull)
      Constructs a cached class representation for the given byte class.
      Parameters:
      klazz - the byte class to cache (either byte.class or Byte.class)
      classInfo - the class information associated with this cached class
      allowNull - true to allow null values (for Byte.class), false for primitive byte
  • Method Details

    • coerceArgument

      public Object coerceArgument(Object argument)
      Coerces the given numeric argument to a byte value.
      Overrides:
      coerceArgument in class NumberCachedClass
      Parameters:
      argument - the argument to coerce
      Returns:
      the argument as a byte, or the original argument if not a number
    • isDirectlyAssignable

      public boolean isDirectlyAssignable(Object argument)
      Checks if the given argument is directly assignable without type conversion.
      Overrides:
      isDirectlyAssignable in class CachedClass
      Parameters:
      argument - the argument to check
      Returns:
      true if the argument is a Byte instance, or null is allowed, false otherwise
    • isAssignableFrom

      public boolean isAssignableFrom(Class classToTransformFrom)
      Determines if the given class can be transformed to byte/Byte.
      Overrides:
      isAssignableFrom in class NumberCachedClass
      Parameters:
      classToTransformFrom - the source class to check
      Returns:
      true if the class can be transformed to byte, false otherwise