Package org.codehaus.groovy.runtime
Class MetaClassHelper
java.lang.Object
org.codehaus.groovy.runtime.MetaClassHelper
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaccessibleToConstructor(Class at, Constructor constructor) static ObjectasPrimitiveArray(List list, Class parameterType) static Object[]asWrapperArray(Object parameters, Class componentType) static longcalculateParameterDistance(Class[] arguments, ParameterTypes pt) static Stringcapitalize(String property) Deprecated, for removal: This API element is subject to removal in a future version.static Class[]castArgumentsToClassArray(Object[] arguments) static ObjectchooseEmptyMethodParams(FastArray methods) static ObjectDeprecated.static booleancontainsMatchingMethod(List list, MetaMethod method) static StringconvertPropertyName(String prop) Converts a String into a standard property name.static Class[]convertToTypeArray(Object[] arguments) Converts array of values (incl.static GroovyRuntimeExceptioncreateExceptionText(String init, MetaMethod method, Object object, Object[] args, Throwable reason, boolean setReason) static voiddoSetMetaClass(Object self, MetaClass mc) Sets the metaclass for an object, by delegating to the appropriateDefaultGroovyMethodshelper method.protected static StringgetClassName(Object object) static ClosuregetMethodPointer(Object object, String methodName) Returns a callable object for the given method name on the object.static booleanisAssignableFrom(Class classToTransformTo, Class classToTransformFrom) static booleanisGenericSetMethod(MetaMethod method) protected static booleanisSuperclass(Class clazz, Class superclass) static voidlogMethodCall(Object object, String methodName, Object[] arguments) static Objectstatic ObjectmakeCommonArray(Object[] arguments, int offset, Class fallback) protected static StringnormalizedValue(Object argument) static booleanparametersAreCompatible(Class[] arguments, Class[] parameters) static booleanstatic booleansameClasses(Class[] params) static booleansameClasses(Class[] params, Object arg1) static booleansameClasses(Class[] params, Object[] arguments) static booleansameClasses(Class[] params, Object[] arguments, boolean weakNullCheck) static booleansameClasses(Class[] params, Object arg1, Object arg2) static booleansameClasses(Class[] params, Object arg1, Object arg2, Object arg3) static booleanprotected static Stringstatic voidstatic Class[] 
- 
Field Details
- 
EMPTY_ARRAY
 - 
EMPTY_TYPE_ARRAY
 - 
EMPTY_CLASS_ARRAY
 - 
ARRAY_WITH_NULL
 
 - 
 - 
Constructor Details
- 
MetaClassHelper
public MetaClassHelper() 
 - 
 - 
Method Details
- 
accessibleToConstructor
 - 
asWrapperArray
 - 
asPrimitiveArray
- Parameters:
 list- the original listparameterType- the resulting array type- Returns:
 - the constructed array
 
 - 
calculateParameterDistance
 - 
capitalize
Deprecated, for removal: This API element is subject to removal in a future version.UseBeanUtils.capitalize(java.lang.String)instead - 
chooseEmptyMethodParams
- Parameters:
 methods- the methods to choose from- Returns:
 - the method with 1 parameter which takes the most general type of object (e.g. Object)
 
 - 
chooseMostGeneralMethodWith1NullParam
Deprecated.Warning: this method does not choose properly if multiple methods with the same distance are encountered- Parameters:
 methods- the methods to choose from- Returns:
 - the method with 1 parameter which takes the most general type of object (e.g. Object) ignoring primitive types
 
 - 
containsMatchingMethod
- Parameters:
 list- a list of MetaMethodsmethod- the MetaMethod of interest- Returns:
 - true if a method of the same matching prototype was found in the list
 
 - 
convertToTypeArray
Converts array of values (incl.null) to their respective types.- Parameters:
 arguments- the arguments- Returns:
 - the types of the arguments
 
 - 
makeCommonArray
 - 
makeArray
 - 
createExceptionText
public static GroovyRuntimeException createExceptionText(String init, MetaMethod method, Object object, Object[] args, Throwable reason, boolean setReason)  - 
getClassName
 - 
getMethodPointer
Returns 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 it's a method pointer, not a closure per se.- Parameters:
 object- the object containing the methodmethodName- the method of interest- Returns:
 - the resulting closure-like method pointer
 
 - 
isAssignableFrom
 - 
isGenericSetMethod
 - 
isSuperclass
 - 
parametersAreCompatible
 - 
logMethodCall
 - 
normalizedValue
 - 
shortName
 - 
wrap
 - 
sameClasses
 - 
sameClasses
 - 
sameClasses
 - 
sameClasses
 - 
sameClasses
 - 
sameClasses
 - 
sameClasses
 - 
sameClass
 - 
castArgumentsToClassArray
- Parameters:
 arguments- an array of classes, values, or nulls
 - 
unwrap
 - 
doSetMetaClass
Sets the metaclass for an object, by delegating to the appropriateDefaultGroovyMethodshelper 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 misuses. Do not use this method directly unless you know what you do.- Parameters:
 self- the object for which to set the metaclassmc- the metaclass
 - 
convertPropertyName
Converts a String into a standard property name.- Parameters:
 prop- the original name- Returns:
 - the converted name
 
 
 - 
 
BeanUtils.capitalize(java.lang.String)instead