groovy.lang.MetaClass.getMetaMethods()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中groovy.lang.MetaClass.getMetaMethods()方法的一些代码示例,展示了MetaClass.getMetaMethods()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getMetaMethods()方法的具体详情如下:
包路径:groovy.lang.MetaClass
类名称:MetaClass
方法名:getMetaMethods

MetaClass.getMetaMethods介绍

[英]Retrieves a list of MetaMethod instances held by this class
[中]检索此类持有的元方法实例列表

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy

public List<MetaMethod> getMetaMethods() {
  return delegate.getMetaMethods();
}

代码示例来源:origin: org.codehaus.groovy/groovy

/**
 * Get info about instance and class Methods that are dynamically added through Groovy.
 *
 * @return Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants
 */
public Object[] getMetaMethods() {
  MetaClass metaClass = InvokerHelper.getMetaClass(objectUnderInspection);
  List metaMethods = metaClass.getMetaMethods();
  Object[] result = new Object[metaMethods.size()];
  int i = 0;
  for (Iterator iter = metaMethods.iterator(); iter.hasNext(); i++) {
    MetaMethod metaMethod = (MetaMethod) iter.next();
    result[i] = methodInfo(metaMethod);
  }
  return result;
}

代码示例来源:origin: org.codehaus.groovy/groovy

public List<MetaMethod> getMetaMethods() {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.getMetaMethods();
}

代码示例来源:origin: org.codehaus.groovy/groovy

ClassInfo ci = ClassInfo.getClassInfo(type);
List<MetaMethod> methods = new ArrayList<MetaMethod>(ci.getMetaClass().getMethods());
methods.addAll(ci.getMetaClass().getMetaMethods());
List<MetaMethod> sugg = rankMethods(methodName,arguments,methods);
StringBuilder sb = new StringBuilder();

代码示例来源:origin: groovy/groovy-core

public void testMetaMethodsOnlyAddedOnce() {
  MetaClass metaClass = InvokerHelper.getMetaClass("some String");
  List methods = metaClass.getMetaMethods();
  for (Iterator iter = methods.iterator(); iter.hasNext();) {
    MetaMethod method = (MetaMethod) iter.next();
    int count = 0;
    for (Iterator inner = methods.iterator(); inner.hasNext();) {
      MetaMethod runner = (MetaMethod) inner.next();
      if (method.equals(runner)) {
        System.out.println("runner = " + runner);
        System.out.println("method = " + method);
        count++;
      }
    }
    assertEquals("count of Method " + method.getName(), 1, count);
  }
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

public List getMetaMethods() {
  return delegate.getMetaMethods();
}
/* (non-Javadoc)

代码示例来源:origin: org.kohsuke.droovy/groovy

public List getMetaMethods() {
  return delegate.getMetaMethods();
}
/* (non-Javadoc)

代码示例来源:origin: org.gperfutils/gprof

@Override
public List<MetaMethod> getMetaMethods() {
  return adaptee.getMetaMethods();
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public List<MetaMethod> getMetaMethods() {
  return delegate.getMetaMethods();
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public List<MetaMethod> getMetaMethods() {
  return delegate.getMetaMethods();
}

代码示例来源:origin: org.gmock/gmock

public List getMetaMethods() {
  return adaptee.getMetaMethods();
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

/**
 * Get info about instance and class Methods that are dynamically added through Groovy.
 *
 * @return Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants
 */
public Object[] getMetaMethods() {
  MetaClass metaClass = InvokerHelper.getMetaClass(objectUnderInspection);
  List metaMethods = metaClass.getMetaMethods();
  Object[] result = new Object[metaMethods.size()];
  int i = 0;
  for (Iterator iter = metaMethods.iterator(); iter.hasNext(); i++) {
    MetaMethod metaMethod = (MetaMethod) iter.next();
    result[i] = methodInfo(metaMethod);
  }
  return result;
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

/**
 * Get info about instance and class Methods that are dynamically added through Groovy.
 * @return  Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants
 */
public Object[] getMetaMethods(){
  MetaClass metaClass = InvokerHelper.getMetaClass(objectUnderInspection);
  List metaMethods = metaClass.getMetaMethods();
  Object[] result = new Object[metaMethods.size()];
  int i=0;
  for (Iterator iter = metaMethods.iterator(); iter.hasNext(); i++) {
    MetaMethod metaMethod = (MetaMethod) iter.next();
    result[i] = methodInfo(metaMethod);
  }
  return result;
}

代码示例来源:origin: org.kohsuke.droovy/groovy

/**
 * Get info about instance and class Methods that are dynamically added through Groovy.
 * @return  Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants
 */
public Object[] getMetaMethods(){
  MetaClass metaClass = InvokerHelper.getMetaClass(objectUnderInspection);
  List metaMethods = metaClass.getMetaMethods();
  Object[] result = new Object[metaMethods.size()];
  int i=0;
  for (Iterator iter = metaMethods.iterator(); iter.hasNext(); i++) {
    MetaMethod metaMethod = (MetaMethod) iter.next();
    result[i] = methodInfo(metaMethod);
  }
  return result;
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

/**
 * Get info about instance and class Methods that are dynamically added through Groovy.
 * @return  Array of StringArrays that can be indexed with the MEMBER_xxx_IDX constants
 */
public Object[] getMetaMethods(){
  MetaClass metaClass = InvokerHelper.getMetaClass(objectUnderInspection);
  List metaMethods = metaClass.getMetaMethods();
  Object[] result = new Object[metaMethods.size()];
  int i=0;
  for (Iterator iter = metaMethods.iterator(); iter.hasNext(); i++) {
    MetaMethod metaMethod = (MetaMethod) iter.next();
    result[i] = methodInfo(metaMethod);
  }
  return result;
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public List<MetaMethod> getMetaMethods() {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.getMetaMethods();
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public List<MetaMethod> getMetaMethods() {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.getMetaMethods();
}

代码示例来源:origin: org.kohsuke.droovy/groovy

public List getMetaMethods() {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.getMetaMethods();
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

ClassInfo ci = ClassInfo.getClassInfo(type);
List<MetaMethod> methods = new ArrayList<MetaMethod>(ci.getMetaClass().getMethods());
methods.addAll(ci.getMetaClass().getMetaMethods());
List<MetaMethod> sugg = rankMethods(methodName,arguments,methods);
StringBuffer sb = new StringBuffer();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-editor

@Override
public Map<MethodSignature, CompletionItem> getMethods(CompletionContext context) {
  final Map<MethodSignature, CompletionItem> result = new HashMap<MethodSignature, CompletionItem>();
  final Class clz = loadClass(context.getTypeName());
  
  if (clz != null) {
    final MetaClass metaClz = GroovySystem.getMetaClassRegistry().getMetaClass(clz);
    if (metaClz != null) {
      for (MetaMethod method : metaClz.getMetaMethods()) {
        populateProposal(clz, method, context.getPrefix(), context.getAnchor(), result, context.isNameOnly());
      }
    }
  }
  return result;
}

相关文章