Package org.apache.bcel.util

Examples of org.apache.bcel.util.ClassVector


   * java.lang.Object is always the last element
   * @throws ClassNotFoundException if any of the superclasses can't be found
   */
  public JavaClass[] getSuperClasses() throws ClassNotFoundException {
    JavaClass clazz = this;
    ClassVector vec = new ClassVector();

    for (clazz = clazz.getSuperClass();
      clazz != null;
      clazz = clazz.getSuperClass()) {
      vec.addElement(clazz);
    }

    return vec.toArray();
  }
View Full Code Here


  /**
   * Get all interfaces implemented by this JavaClass (transitively).
   */
  public JavaClass[] getAllInterfaces() throws ClassNotFoundException {
    ClassQueue queue = new ClassQueue();
    ClassVector vec = new ClassVector();

    queue.enqueue(this);

    while (!queue.empty()) {
      JavaClass clazz = queue.dequeue();

      JavaClass souper = clazz.getSuperClass();
      JavaClass[] interfaces = clazz.getInterfaces();

      if (clazz.isInterface()) {
        vec.addElement(clazz);
      } else {
        if (souper != null) {
          queue.enqueue(souper);
        }
      }

      for (int i = 0; i < interfaces.length; i++) {
        queue.enqueue(interfaces[i]);
      }
    }

    return vec.toArray();
  }
View Full Code Here

   * @return list of super classes of this class in ascending order, i.e.,
   * java.lang.Object is always the last element
   */
  public JavaClass[] getSuperClasses() {
    JavaClass   clazz = this;
    ClassVector vec   = new ClassVector();

    for(clazz = clazz.getSuperClass(); clazz != null;
  clazz = clazz.getSuperClass())
    {
      vec.addElement(clazz);
    }

    return vec.toArray();
  }
View Full Code Here

  /**
   * Get all interfaces implemented by this JavaClass (transitively).
   */
  public JavaClass[] getAllInterfaces() {
    ClassQueue  queue = new ClassQueue();
    ClassVector vec   = new ClassVector();
   
    queue.enqueue(this);
   
    while(!queue.empty()) {
      JavaClass clazz = queue.dequeue();
     
      JavaClass   souper     = clazz.getSuperClass();
      JavaClass[] interfaces = clazz.getInterfaces();
     
      if(clazz.isInterface()) {
  vec.addElement(clazz);
      } else {
  if(souper != null) {
    queue.enqueue(souper);
  }
      }
     
      for(int i = 0; i < interfaces.length; i++) {
  queue.enqueue(interfaces[i]);
      }
    }
     
    return vec.toArray();
  }
View Full Code Here

TOP

Related Classes of org.apache.bcel.util.ClassVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.