Skip to content

Commit

Permalink
Add some methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mouse0w0 committed Aug 1, 2020
1 parent 42c9d8e commit 8e87ba2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/com/github/mouse0w0/asm/extree/ClassNodeEx.java
Expand Up @@ -163,14 +163,29 @@ public AnnotationNodeEx getAnnotation(String descriptor) {
return annotations == null ? null : annotations.get(descriptor);
}

public void addAnnotation(AnnotationNodeEx annotationNode) {
if (annotations == null) {
annotations = new LinkedHashMap<>(2);
}
annotations.put(annotationNode.desc, annotationNode);
}

public FieldNodeEx getField(String name) {
return fields.get(name);
}

public void addField(FieldNodeEx fieldNode) {
fields.put(fieldNode.name, fieldNode);
}

public MethodNodeEx getMethod(Method method) {
return methods.get(method);
}

public void addMethod(MethodNodeEx methodNode) {
methods.put(new Method(methodNode.name, methodNode.desc), methodNode);
}

// -----------------------------------------------------------------------------------------------
// Implementation of the ClassVisitor abstract class
// -----------------------------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/github/mouse0w0/asm/extree/FieldNodeEx.java
Expand Up @@ -113,6 +113,13 @@ public AnnotationNodeEx getAnnotation(String descriptor) {
return annotations == null ? null : annotations.get(descriptor);
}

public void addAnnotation(AnnotationNodeEx annotationNode) {
if (annotations == null) {
annotations = new LinkedHashMap<>(2);
}
annotations.put(annotationNode.desc, annotationNode);
}

// -----------------------------------------------------------------------------------------------
// Implementation of the FieldVisitor abstract class
// -----------------------------------------------------------------------------------------------
Expand Down
Expand Up @@ -181,6 +181,13 @@ public AnnotationNodeEx getAnnotation(String descriptor) {
return annotations == null ? null : annotations.get(descriptor);
}

public void addAnnotation(AnnotationNodeEx annotationNode) {
if (annotations == null) {
annotations = new LinkedHashMap<>(2);
}
annotations.put(annotationNode.desc, annotationNode);
}

// -----------------------------------------------------------------------------------------------
// Implementation of the MethodVisitor abstract class
// -----------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 8e87ba2

Please sign in to comment.