public MetaMethod getMetaMethod(String name, Object[] args) { return this.delegate.getMetaMethod(name, args); }
public MetaMethod getMetaMethod(String name, Object[] args) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.getMetaMethod(name, args); }
public MetaMethod getMetaMethod(String name, Class[] argTypes) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.getMetaMethod(name, argTypes); }
/** * Hook to deal with the case of MissingProperty for static properties. The method will look attempt to look up * "propertyMissing" handlers and invoke them otherwise thrown a MissingPropertyException * * @param instance The instance * @param propertyName The name of the property * @param optionalValue The value in the case of a setter * @param isGetter True if its a getter * @return The value in the case of a getter or a MissingPropertyException */ protected Object invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter) { MetaClass mc = instance instanceof Class ? registry.getMetaClass((Class) instance) : this; if (isGetter) { MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, GETTER_MISSING_ARGS); if (propertyMissing != null) { return propertyMissing.invoke(instance, new Object[]{propertyName}); } } else { MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, SETTER_MISSING_ARGS); if (propertyMissing != null) { return propertyMissing.invoke(instance, new Object[]{propertyName, optionalValue}); } } if (instance instanceof Class) { throw new MissingPropertyException(propertyName, (Class) instance); } throw new MissingPropertyException(propertyName, theClass); }
public Object invokeMethod(String name, Object args) { final Object[] argsArr = args instanceof Object[] ? (Object[]) args : new Object[]{args}; MetaMethod metaMethod = myMetaClass.getMetaMethod(name, argsArr); if (metaMethod != null) { // we have to use doMethodInvoke here instead of simply invoke, // because getMetaMethod may provide a method that can not be called // without further argument transformation, which is done only in // doMethodInvoke return metaMethod.doMethodInvoke(this, argsArr); } if (argsArr.length == 2 && argsArr[0] instanceof Class && argsArr[1] instanceof Closure) { if (argsArr[0] == theClass) registerInstanceMethod(name, (Closure) argsArr[1]); else { registerSubclassInstanceMethod(name, (Class) argsArr[0], (Closure) argsArr[1]); } return null; } if (argsArr.length == 1 && argsArr[0] instanceof Closure) { registerInstanceMethod(name, (Closure) argsArr[0]); return null; } throw new MissingMethodException(name, getClass(), argsArr); }
@Override public MetaMethod getMetaMethod(String name, Object[] argTypes) { return adaptee.getMetaMethod(name, argTypes); }
public MetaMethod getMetaMethod(String name, Class[] argTypes) { return this.delegate.getMetaMethod(name, argTypes); }
public MetaMethod getMetaMethod(String name, Object[] args) { return this.delegate.getMetaMethod(name, args); }
public MetaMethod getMetaMethod(String name, Class[] argTypes) { return this.delegate.getMetaMethod(name, argTypes); }
private static EventTriggerCaller resolveMetaMethodCaller(String eventMethodName, MetaClass metaClass) { MetaMethod metaMethod = metaClass.getMetaMethod(eventMethodName, EMPTY_ARRAY); if (metaMethod != null) { return new MetaMethodCaller(metaMethod); } return null; }
private MetaMethod getMetaMethodFromMutableMetaClass(String methodName, Object[] arguments, MetaClass metaClass) { final boolean isModified = ((MutableMetaClass) metaClass).isModified(); return isModified ? metaClass.getMetaMethod(methodName, arguments) : null; }
@Nullable @Override protected MetaMethod lookupMethod(MetaClass metaClass, String name, Class[] arguments) { MetaMethod metaMethod = super.lookupMethod(metaClass, name, arguments); if (metaMethod != null) { return metaMethod; } metaMethod = classMetaData.getMetaMethod(name, arguments); if (metaMethod != null && Modifier.isStatic(metaMethod.getModifiers())) { return metaMethod; } return null; } }
protected MetaMethod getToXMLMethod(Object object) { MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(object.getClass()); if (mc != null) { return mc.getMetaMethod("toXML", new Object[] { XML.class }); } return null; } }
protected MetaMethod getToJSONMethod(Object object) { MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(object.getClass()); if (mc != null) { return mc.getMetaMethod("toJSON", new Object[] { JSON.class }); } return null; } }
public MetaMethod getMetaMethod(String name, Class[] argTypes) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.getMetaMethod(name, argTypes); }
public MetaMethod getMetaMethod(String name, Object[] args) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.getMetaMethod(name, args); }
public MetaMethod getMetaMethod(String name, Object[] args) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.getMetaMethod(name, args); }
public MetaMethod getMetaMethod(String name, Class[] argTypes) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.getMetaMethod(name, argTypes); }
public MetaMethod getMetaMethod(String name, Object[] args) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.getMetaMethod(name, args); }
public MetaMethod getMetaMethod(String name, Class[] argTypes) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.getMetaMethod(name, argTypes); }