MCPcopy Index your code
hub / github.com/apache/groovy / getMethods

Method getMethods

src/main/java/groovy/lang/MetaClassImpl.java:751–788  ·  view source on GitHub ↗

Gets all the normal object methods of this class for the given name. @return object methods available from this class for given name

(final Class<?> sender, final String name, final boolean isCallToSuper)

Source from the content-addressed store, hash-verified

749 * @return object methods available from this class for given name
750 */
751 private Object getMethods(final Class<?> sender, final String name, final boolean isCallToSuper) {
752 Object answer;
753
754 var entry = metaMethodIndex.getMethods( sender , name);
755 if (entry == null && !isGroovyFunctor()) {
756 entry = metaMethodIndex.getMethods(theClass, name);
757 }
758 if (entry == null) {
759 answer = FastArray.EMPTY_LIST;
760 } else if (isCallToSuper) {
761 answer = entry.methodsForSuper;
762 } else {
763 answer = entry.methods;
764 }
765
766 if (answer == null) answer = FastArray.EMPTY_LIST;
767
768 if (!isCallToSuper) {
769 List<CategoryMethod> methods = GroovyCategorySupport.getCategoryMethods(name);
770 if (methods != null) {
771 FastArray array;
772 if (answer instanceof FastArray fastArray) {
773 array = fastArray.copy();
774 } else {
775 array = new FastArray();
776 array.add(answer);
777 }
778 for (CategoryMethod cm : methods) {
779 Class<?> cmdc = cm.getDeclaringClass().getTheClass();
780 if (cmdc == Object.class ? !isGroovyFunctor() // GROOVY-7685
781 : cmdc.isAssignableFrom(theClass)) // GROOVY-11813
782 filterMatchingMethodForCategory(array, cm);
783 }
784 answer = array;
785 }
786 }
787 return answer;
788 }
789
790 /**
791 * Gets all the normal static methods of this class for the given name.

Callers 3

respondsToMethod · 0.95
findMethodMethod · 0.95

Calls 9

isGroovyFunctorMethod · 0.95
getCategoryMethodsMethod · 0.95
addMethod · 0.95
getMethodsMethod · 0.65
getTheClassMethod · 0.65
copyMethod · 0.45
getDeclaringClassMethod · 0.45
isAssignableFromMethod · 0.45

Tested by

no test coverage detected