Modifiers | Name | Description |
---|---|---|
static Object[] |
ARRAY_WITH_NULL |
|
static Object[] |
EMPTY_ARRAY |
|
static Class[] |
EMPTY_CLASS_ARRAY |
|
static Class[] |
EMPTY_TYPE_ARRAY |
|
protected static Logger |
LOG |
Type Params | Return Type | Name and description |
---|---|---|
|
static boolean |
accessibleToConstructor(Class at, Constructor constructor) |
|
static Object |
asPrimitiveArray(List list, Class parameterType) @param list the original list |
|
static Object[] |
asWrapperArray(Object parameters, Class componentType) |
|
static long |
calculateParameterDistance(Class[] arguments, ParameterTypes pt) note: when shifting with 32 bit, you should only shift on a long. |
|
static String |
capitalize(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 Class[] |
castArgumentsToClassArray(Object[] argTypes) |
|
static Object |
chooseEmptyMethodParams(FastArray methods) @param methods the methods to choose from |
|
static Object |
chooseMostGeneralMethodWith1NullParam(FastArray methods) Warning: this method does not choose properly if multiple methods with the same distance are encountered |
|
static boolean |
containsMatchingMethod(List list, MetaMethod method) @param list a list of MetaMethods |
|
static String |
convertPropertyName(String prop) Converts a String into a standard property name. |
|
static Class[] |
convertToTypeArray(Object[] args) param instance array to the type array |
|
static GroovyRuntimeException |
createExceptionText(String init, MetaMethod method, Object object, Object[] args, Throwable reason, boolean setReason) |
|
static void |
doSetMetaClass(Object self, MetaClass mc) Sets the meta class for an object, by delegating to the appropriate DefaultGroovyMethods helper method. |
|
protected static String |
getClassName(Object object) |
|
static Closure |
getMethodPointer(Object object, String methodName) Returns a callable object for the given method name on the object. |
|
static boolean |
isAssignableFrom(Class classToTransformTo, Class classToTransformFrom) |
|
static boolean |
isGenericSetMethod(MetaMethod method) |
|
protected static boolean |
isSuperclass(Class clazz, Class superclass) |
|
static void |
logMethodCall(Object object, String methodName, Object[] arguments) |
|
static Object |
makeArray(Object obj, Class secondary, int length) |
|
static Object |
makeCommonArray(Object[] arguments, int offset, Class fallback) |
|
protected static String |
normalizedValue(Object argument) |
|
static boolean |
parametersAreCompatible(Class[] arguments, Class[] parameters) |
|
static boolean |
sameClass(Class[] params, Object arg) |
|
static boolean |
sameClasses(Class[] params, Object[] arguments, boolean weakNullCheck) |
|
static boolean |
sameClasses(Class[] params, Object[] arguments) |
|
static boolean |
sameClasses(Class[] params) |
|
static boolean |
sameClasses(Class[] params, Object arg1) |
|
static boolean |
sameClasses(Class[] params, Object arg1, Object arg2) |
|
static boolean |
sameClasses(Class[] params, Object arg1, Object arg2, Object arg3) |
|
static boolean |
sameClasses(Class[] params, Object arg1, Object arg2, Object arg3, Object arg4) |
|
protected static String |
shortName(Object object) |
|
static void |
unwrap(Object[] arguments) |
|
static Class[] |
wrap(Class[] classes) |
list
- the original listparameterType
- the resulting array typenote: when shifting with 32 bit, you should only shift on a long. If you do that with an int, then i==(i<<32), which means you loose the shift information
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
methods
- the methods to choose fromWarning: this method does not choose properly if multiple methods with the same distance are encountered
methods
- the methods to choose from
list
- a list of MetaMethodsmethod
- the MetaMethod of interestConverts a String into a standard property name.
prop
- the original nameparam instance array to the type array
args
- the argumentsSets 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.
self
- the object for which to set the meta classmc
- the metaclassReturns a callable object for the given method name on the object. The object acts like a Closure in that it can be called, like a closure and passed around - though really its a method pointer, not a closure per se.
object
- the object containing the methodmethodName
- the method of interest