Advertisement
Guest User

ClassVisitor

a guest
Jan 7th, 2021
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.62 KB | None | 0 0
  1. package org.objectweb.asm;
  2.  
  3. public abstract class ClassVisitor {
  4.  
  5.     protected final int api;
  6.     protected ClassVisitor cv;
  7.  
  8.     public ClassVisitor(int api) {
  9.         this(api, (ClassVisitor) null);
  10.     }
  11.  
  12.     public ClassVisitor(int api, ClassVisitor classVisitor) {
  13.         this.api = api;
  14.         this.cv = classVisitor;
  15.     }
  16.  
  17.     public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
  18.         if (this.cv != null) {
  19.             this.cv.visit(version, access, name, signature, superName, interfaces);
  20.         }
  21.  
  22.     }
  23.  
  24.     public void visitSource(String source, String debug) {
  25.         if (this.cv != null) {
  26.             this.cv.visitSource(source, debug);
  27.         }
  28.     }
  29.  
  30.     public ModuleVisitor visitModule(String name, int access, String version) {
  31.         if (this.api < 393216) {
  32.             throw new UnsupportedOperationException();
  33.         } else {
  34.             return this.cv != null ? this.cv.visitModule(name, access, version) : null;
  35.         }
  36.     }
  37.  
  38.     @Deprecated
  39.     public void visitNestHostExperimental(String nestHost) {
  40.         if (this.cv != null) {
  41.             this.cv.visitNestHostExperimental(nestHost);
  42.         }
  43.     }
  44.  
  45.     public void visitOuterClass(String owner, String name, String descriptor) {
  46.         if (this.cv != null) {
  47.             this.cv.visitOuterClass(owner, name, descriptor);
  48.         }
  49.  
  50.     }
  51.  
  52.     public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
  53.         return this.cv != null ? this.cv.visitAnnotation(descriptor, visible) : null;
  54.     }
  55.  
  56.     public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String descriptor, boolean visible) {
  57.         return this.cv != null ? this.cv.visitTypeAnnotation(typeRef, typePath, descriptor, visible) : null;
  58.     }
  59.  
  60.     public void visitAttribute(Attribute attribute) {
  61.         if (this.cv != null) {
  62.             this.cv.visitAttribute(attribute);
  63.         }
  64.     }
  65.  
  66.     @Deprecated
  67.     public void visitNestMemberExperimental(String nestMember) {
  68.         if (this.cv != null) {
  69.             this.cv.visitNestMemberExperimental(nestMember);
  70.         }
  71.     }
  72.  
  73.     public void visitInnerClass(String name, String outerName, String innerName, int access) {
  74.         if (this.cv != null) {
  75.             this.cv.visitInnerClass(name, outerName, innerName, access);
  76.         }
  77.  
  78.     }
  79.  
  80.     public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
  81.         return this.cv != null ? this.cv.visitField(access, name, descriptor, signature, value) : null;
  82.     }
  83.  
  84.     public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
  85.         return this.cv != null ? this.cv.visitMethod(access, name, descriptor, signature, exceptions) : null;
  86.     }
  87.  
  88.     public void visitEnd() {
  89.         if (this.cv != null) {
  90.             this.cv.visitEnd();
  91.         }
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement