Class ArrayCachedClass

java.lang.Object
org.codehaus.groovy.reflection.CachedClass
org.codehaus.groovy.reflection.stdclasses.ArrayCachedClass

public class ArrayCachedClass extends CachedClass
Provides optimized reflection caching for Java arrays. Handles type coercion including conversion of boxed arrays to primitive arrays, and GString arrays to String arrays.
  • Constructor Details

    • ArrayCachedClass

      public ArrayCachedClass(Class klazz, ClassInfo classInfo)
      Constructs a cached class representation for the given array class.
      Parameters:
      klazz - the array class to cache
      classInfo - the class information associated with this cached class
  • Method Details

    • coerceArgument

      public Object coerceArgument(Object argument)
      Coerces the given argument to the appropriate array type. Converts boxed arrays to primitive arrays if needed, and GString arrays to String arrays.
      Overrides:
      coerceArgument in class CachedClass
      Parameters:
      argument - the argument to coerce
      Returns:
      the coerced argument, or the original argument if no coercion is needed