Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.runtime
[Java] Class MetaClassHelper

    java.lang.Object
      org.codehaus.groovy.runtime.MetaClassHelper

    public class MetaClassHelper
    extends java.lang.Object

Authors:
  John Wilson
  Jochen Theodorou

Field Summary
`static java.lang.Object[]` | `ARRAY_WITH_NULL`
`static java.lang.Object[]` | `EMPTY_ARRAY`
`static java.lang.Class[]` | `EMPTY_CLASS_ARRAY`
`static java.lang.Class[]` | `EMPTY_TYPE_ARRAY`
`protected static Logger` | `LOG`

Method Summary
`static boolean` | `accessibleToConstructor(java.lang.Class at, java.lang.reflect.Constructor constructor)`
`static java.lang.Object` | `asPrimitiveArray(java.util.List list, java.lang.Class parameterType)` @param list the original list
`static java.lang.Object[]` | `asWrapperArray(java.lang.Object parameters, java.lang.Class componentType)`
`static long` | `calculateParameterDistance(java.lang.Class[] arguments, ParameterTypes pt)`
`static java.lang.String` | `capitalize(java.lang.String property)` In general we want to match the signature that allows us to use as less arguments for the vargs part as possible.
`static java.lang.Class[]` | `castArgumentsToClassArray(java.lang.Object[] argTypes)`
`static java.lang.Object` | `chooseEmptyMethodParams(FastArray methods)`
`static java.lang.Object` | `chooseMostGeneralMethodWith1NullParam(FastArray methods)`
`static boolean` | `containsMatchingMethod(java.util.List list, MetaMethod method)`
`static java.lang.Class[]` | `convertToTypeArray(java.lang.Object[] args)`
`static GroovyRuntimeException` | `createExceptionText(java.lang.String init, MetaMethod method, java.lang.Object object, java.lang.Object[] args, java.lang.Throwable reason, boolean setReason)`
`static void` | `doSetMetaClass(java.lang.Object self, MetaClass mc)`
`protected static java.lang.String` | `getClassName(java.lang.Object object)`
`static Closure` | `getMethodPointer(java.lang.Object object, java.lang.String methodName)`
`static boolean` | `isAssignableFrom(java.lang.Class classToTransformTo, java.lang.Class classToTransformFrom)`
`static boolean` | `isGenericSetMethod(MetaMethod method)`
`protected static boolean` | `isSuperclass(java.lang.Class clazz, java.lang.Class superclass)`
`static void` | `logMethodCall(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)`
`static java.lang.Object` | `makeArray(java.lang.Object obj, java.lang.Class secondary, int length)`
`static java.lang.Object` | `makeCommonArray(java.lang.Object[] arguments, int offset, java.lang.Class fallback)`
`protected static java.lang.String` | `normalizedValue(java.lang.Object argument)`
`static boolean` | `parametersAreCompatible(java.lang.Class[] arguments, java.lang.Class[] parameters)`
`static boolean` | `sameClass(java.lang.Class[] params, java.lang.Object arg)`
`static boolean` | `sameClasses(java.lang.Class[] params, java.lang.Object[] arguments, boolean weakNullCheck)`
`static boolean` | `sameClasses(java.lang.Class[] params, java.lang.Object[] arguments)`
`static boolean` | `sameClasses(java.lang.Class[] params)`
`static boolean` | `sameClasses(java.lang.Class[] params, java.lang.Object arg1)`
`static boolean` | `sameClasses(java.lang.Class[] params, java.lang.Object arg1, java.lang.Object arg2)`
`static boolean` | `sameClasses(java.lang.Class[] params, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)`
`static boolean` | `sameClasses(java.lang.Class[] params, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)` Sets the meta class for an object, by delegating to the appropriate DefaultGroovyMethods helper method.
`protected static java.lang.String` | `shortName(java.lang.Object object)`
`static void` | `unwrap(java.lang.Object[] arguments)`
`static java.lang.Class[]` | `wrap(java.lang.Class[] classes)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### ARRAY_WITH_NULL

    public static final java.lang.Object[] ARRAY_WITH_NULL

### EMPTY_ARRAY

    public static final java.lang.Object[] EMPTY_ARRAY

### EMPTY_CLASS_ARRAY

    public static final java.lang.Class[] EMPTY_CLASS_ARRAY

### EMPTY_TYPE_ARRAY

    public static final java.lang.Class[] EMPTY_TYPE_ARRAY

### LOG

    protected static final Logger LOG

Method Detail

### accessibleToConstructor

    public static boolean accessibleToConstructor(java.lang.Class at, java.lang.reflect.Constructor constructor)

### asPrimitiveArray

    public static java.lang.Object asPrimitiveArray(java.util.List list, java.lang.Class parameterType)

  Parameters:
    `list` - the original list
    `parameterType` - the resulting array type
  Returns:
    the constructed array

### asWrapperArray

    public static java.lang.Object[] asWrapperArray(java.lang.Object parameters, java.lang.Class componentType)

### calculateParameterDistance

    public static long calculateParameterDistance(java.lang.Class[] arguments, ParameterTypes pt)

### capitalize

    public static java.lang.String capitalize(java.lang.String property)

  In general we want to match the signature that allows us to use as less arguments for the vargs part as possible. That means the longer signature usually wins if both signatures are vargs, while vargs looses always against a signature without vargs. A vs B : def foo(Object[] a) {1} -> case B def foo(a,b,Object[] c) {2} -> case A assert foo(new Object(),new Object()) == 2 --> A preferred over B A vs C : def foo(Object[] a) {1} -> case B def foo(a,b) {2} -> case C assert foo(new Object(),new Object()) == 2 --> C preferred over A A vs D : def foo(Object[] a) {1} -> case D def foo(a,Object[] b) {2} -> case A assert foo(new Object()) == 2 --> A preferred over D This gives C case B def foo(a,b) {2} -> case C assert foo(new Object(),new Object()) == 2 --> C preferred over B, matches C case B def foo(a,Object[] b) {2} -> case D assert foo(new Object(),new Object()) == 2 --> D preferred over B This gives C

### castArgumentsToClassArray

    public static java.lang.Class[] castArgumentsToClassArray(java.lang.Object[] argTypes)

### chooseEmptyMethodParams

    public static java.lang.Object chooseEmptyMethodParams(FastArray methods)

### chooseMostGeneralMethodWith1NullParam

    public static java.lang.Object chooseMostGeneralMethodWith1NullParam(FastArray methods)

### containsMatchingMethod

    public static boolean containsMatchingMethod(java.util.List list, MetaMethod method)

### convertToTypeArray

    public static java.lang.Class[] convertToTypeArray(java.lang.Object[] args)

### createExceptionText

    public static GroovyRuntimeException createExceptionText(java.lang.String init, MetaMethod method, java.lang.Object object, java.lang.Object[] args, java.lang.Throwable reason, boolean setReason)

### doSetMetaClass

    public static void doSetMetaClass(java.lang.Object self, MetaClass mc)

### getClassName

    protected static java.lang.String getClassName(java.lang.Object object)

### getMethodPointer

    public static Closure getMethodPointer(java.lang.Object object, java.lang.String methodName)

### isAssignableFrom

    public static boolean isAssignableFrom(java.lang.Class classToTransformTo, java.lang.Class classToTransformFrom)

### isGenericSetMethod

    public static boolean isGenericSetMethod(MetaMethod method)

### isSuperclass

    protected static boolean isSuperclass(java.lang.Class clazz, java.lang.Class superclass)

### logMethodCall

    public static void logMethodCall(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)

### makeArray

    public static java.lang.Object makeArray(java.lang.Object obj, java.lang.Class secondary, int length)

### makeCommonArray

    public static java.lang.Object makeCommonArray(java.lang.Object[] arguments, int offset, java.lang.Class fallback)

### normalizedValue

    protected static java.lang.String normalizedValue(java.lang.Object argument)

### parametersAreCompatible

    public static boolean parametersAreCompatible(java.lang.Class[] arguments, java.lang.Class[] parameters)

### sameClass

    public static boolean sameClass(java.lang.Class[] params, java.lang.Object arg)

### sameClasses

    public static boolean sameClasses(java.lang.Class[] params, java.lang.Object[] arguments, boolean weakNullCheck)

### sameClasses

    public static boolean sameClasses(java.lang.Class[] params, java.lang.Object[] arguments)

### sameClasses

    public static boolean sameClasses(java.lang.Class[] params)

### sameClasses

    public static boolean sameClasses(java.lang.Class[] params, java.lang.Object arg1)

### sameClasses

    public static boolean sameClasses(java.lang.Class[] params, java.lang.Object arg1, java.lang.Object arg2)

### sameClasses

    public static boolean sameClasses(java.lang.Class[] params, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)

### sameClasses

    public static boolean sameClasses(java.lang.Class[] params, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)

  Sets the meta class for an object, by delegating to the appropriate DefaultGroovyMethods helper method. This method was introduced as a breaking change in 2.0 to solve rare cases of stack overflow. See GROOVY-5285. The method is named doSetMetaClass in order to prevent misusages. Do not use this method directly unless you know what you do.
  Parameters:
    `self` - the object for which to set the meta class
    `mc` - the metaclass

### shortName

    protected static java.lang.String shortName(java.lang.Object object)

### unwrap

    public static void unwrap(java.lang.Object[] arguments)

### wrap

    public static java.lang.Class[] wrap(java.lang.Class[] classes)

Groovy Documentation