Package org.codehaus.groovy.reflection.stdclasses

# Class ShortCachedClass

java.lang.Object
org.codehaus.groovy.reflection.CachedClass
org.codehaus.groovy.reflection.stdclasses.NumberCachedClass
org.codehaus.groovy.reflection.stdclasses.ShortCachedClass

public class ShortCachedClass extends NumberCachedClass
Provides optimized reflection caching for `short` and `Short`. Coerces numeric arguments to short values for type-safe method invocation. Optionally allows `null` values for the boxed `Short` class variant.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.codehaus.groovy.reflection.CachedClass

  `CachedClass.CachedMethodComparatorByName, CachedClass.CachedMethodComparatorWithString`

- ## Field Summary

  ### Fields inherited from class org.codehaus.groovy.reflection.CachedClass

  `classInfo, EMPTY_ARRAY, isArray, isInterface, isNumber, isPrimitive, modifiers, mopMethods`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ShortCachedClass(Class klazz, ClassInfo classInfo, boolean allowNull)`
  Constructs a cached class representation for the given short class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `coerceArgument(Object argument)`
  Coerces the given numeric argument to a short value.
  `boolean`
  `isAssignableFrom(Class classToTransformFrom)`
  Determines if the given class can be transformed to short/Short.
  `boolean`
  `isDirectlyAssignable(Object argument)`
  Checks if the given argument is directly assignable without type conversion.

  ### Methods inherited from class org.codehaus.groovy.reflection.CachedClass

  `addNewMopMethods, getCachedClass, getCachedSuperClass, getCallSiteLoader, getConstructors, getDeclaredInterfaces, getFields, getHierarchy, getInterfaces, getMethods, getModifiers, getName, getNewMetaMethods, getSuperClassDistance, getTheClass, getTypeDescription, hashCode, isInterface, isPrimitive, isVoid, searchMethods, setNewMopMethods, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ShortCachedClass

    public ShortCachedClass(Class klazz, ClassInfo classInfo, boolean allowNull)
    Constructs a cached class representation for the given short class.
    Parameters:
      `klazz` - the short class to cache (either `short.class` or `Short`.class)
      `classInfo` - the class information associated with this cached class
      `allowNull` - `true` to allow `null` values (for `Short`.class), `false` for primitive `short`

- ## Method Details

  - ### coerceArgument

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

  - ### isAssignableFrom

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