本文整理了Java中groovy.lang.MetaClass.getMetaMethod()
方法的一些代码示例,展示了MetaClass.getMetaMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getMetaMethod()
方法的具体详情如下:
包路径:groovy.lang.MetaClass
类名称:MetaClass
方法名:getMetaMethod
[英]Retrieves a list of MetaMethod instances held by this class
[中]检索此类持有的元方法实例列表
代码示例来源:origin: org.codehaus.groovy/groovy
public MetaMethod getMetaMethod(String name, Object[] args) {
return this.delegate.getMetaMethod(name, args);
}
代码示例来源:origin: org.codehaus.groovy/groovy
public MetaMethod getMetaMethod(String name, Object[] args) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaMethod(name, args);
}
代码示例来源:origin: org.codehaus.groovy/groovy
public MetaMethod getMetaMethod(String name, Class[] argTypes) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaMethod(name, argTypes);
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* 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);
}
代码示例来源:origin: org.codehaus.groovy/groovy
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);
}
代码示例来源:origin: org.gperfutils/gprof
@Override
public MetaMethod getMetaMethod(String name, Object[] argTypes) {
return adaptee.getMetaMethod(name, argTypes);
}
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
public MetaMethod getMetaMethod(String name, Class[] argTypes) {
return this.delegate.getMetaMethod(name, argTypes);
}
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
public MetaMethod getMetaMethod(String name, Object[] args) {
return this.delegate.getMetaMethod(name, args);
}
代码示例来源:origin: org.kohsuke.droovy/groovy
public MetaMethod getMetaMethod(String name, Class[] argTypes) {
return this.delegate.getMetaMethod(name, argTypes);
}
代码示例来源:origin: org.grails/grails-datastore-gorm
private static EventTriggerCaller resolveMetaMethodCaller(String eventMethodName, MetaClass metaClass) {
MetaMethod metaMethod = metaClass.getMetaMethod(eventMethodName, EMPTY_ARRAY);
if (metaMethod != null) {
return new MetaMethodCaller(metaMethod);
}
return null;
}
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
private MetaMethod getMetaMethodFromMutableMetaClass(String methodName, Object[] arguments, MetaClass metaClass) {
final boolean isModified = ((MutableMetaClass) metaClass).isModified();
return isModified ? metaClass.getMetaMethod(methodName, arguments) : null;
}
代码示例来源:origin: org.gradle/gradle-core
@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;
}
}
代码示例来源:origin: org.grails/grails-plugin-converters
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;
}
}
代码示例来源:origin: org.grails/grails-plugin-converters
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;
}
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
public MetaMethod getMetaMethod(String name, Class[] argTypes) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaMethod(name, argTypes);
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
public MetaMethod getMetaMethod(String name, Object[] args) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaMethod(name, args);
}
代码示例来源:origin: org.kohsuke.droovy/groovy
public MetaMethod getMetaMethod(String name, Object[] args) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaMethod(name, args);
}
代码示例来源:origin: org.kohsuke.droovy/groovy
public MetaMethod getMetaMethod(String name, Class[] argTypes) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaMethod(name, argTypes);
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
public MetaMethod getMetaMethod(String name, Object[] args) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaMethod(name, args);
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
public MetaMethod getMetaMethod(String name, Class[] argTypes) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaMethod(name, argTypes);
}
内容来源于网络,如有侵权,请联系作者删除!