Class LongCachedClass


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

    • LongCachedClass

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

    • coerceArgument

      public Object coerceArgument(Object argument)
      Coerces the given numeric argument to a long value.
      Overrides:
      coerceArgument in class NumberCachedClass
      Parameters:
      argument - the argument to coerce
      Returns:
      the argument as a long, 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 Long instance, or null is allowed, false otherwise
    • isAssignableFrom

      public boolean isAssignableFrom(Class classToTransformFrom)
      Determines if the given class can be transformed to long/Long. Accepts integral types and boxed integral types.
      Overrides:
      isAssignableFrom in class NumberCachedClass
      Parameters:
      classToTransformFrom - the source class to check
      Returns:
      true if the class can be transformed to long, false otherwise