MCPcopy Create free account
hub / github.com/apache/groovy / addMethod

Method addMethod

src/main/java/org/codehaus/groovy/ast/ClassNode.java:856–864  ·  view source on GitHub ↗

Adds a MethodNode to this ClassNode. The method is added to the internal methods list and registered by name in the methods map for fast lookup. The method's declaring class is set to this node's redirect target. This method does not check for duplicates. @param node the MethodNode

(MethodNode node)

Source from the content-addressed store, hash-verified

854 * @see MethodNode
855 */
856 public void addMethod(MethodNode node) {
857 ClassNode r = redirect();
858 node.setDeclaringClass(r);
859 if (r.methodsList.isEmpty()) {
860 r.methodsList = new ArrayList<>(4);
861 }
862 r.methodsList.add(node);
863 r.methods.put(node.getName(), node);
864 }
865
866 /**
867 * Creates and adds a {@link MethodNode} to this ClassNode with the specified properties,

Calls 7

redirectMethod · 0.95
getDeclaredMethodMethod · 0.95
addMethod · 0.65
putMethod · 0.65
getNameMethod · 0.65
setDeclaringClassMethod · 0.45
isEmptyMethod · 0.45