Class ClassHierarchyStore

  • All Implemented Interfaces:
    ClassHierarchyProvider

    public final class ClassHierarchyStore
    extends java.lang.Object
    implements ClassHierarchyProvider
    This implementation of ClassHierarchyProvider is a simple writable data structure representing a class hierarchy. You call setClassInfo to record information about a class.
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassHierarchyStore()
      Create an empty store.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsClass​(java.lang.String cl)  
      java.lang.String[] getSubClasses​(java.lang.String cl)  
      java.lang.String getSuperClass​(java.lang.String cl)  
      java.lang.String[] getSuperInterfaces​(java.lang.String cl)  
      int isInterface​(java.lang.String cl)  
      java.util.Iterator<java.lang.String> iterateOverClasses()
      Iterate through all classes in the store.
      void removeClassInfo​(java.lang.String cl)
      Delete the class information from the store.
      void setClassInfo​(java.lang.String cl, boolean isInterface, boolean isFinal, java.lang.String superClass, java.lang.String[] superInterfaces)
      Append some class information to the store.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClassHierarchyStore

        public ClassHierarchyStore()
        Create an empty store.
    • Method Detail

      • containsClass

        public boolean containsClass​(java.lang.String cl)
      • setClassInfo

        public void setClassInfo​(java.lang.String cl,
                                 boolean isInterface,
                                 boolean isFinal,
                                 java.lang.String superClass,
                                 java.lang.String[] superInterfaces)
                          throws java.lang.IllegalArgumentException
        Append some class information to the store.
        Parameters:
        cl - the JVM type of the class being added (e.g., Ljava/lang/Object;)
        isInterface - true iff it's an interface
        isFinal - true iff it's final
        superClass - the JVM type of the superclass, or null if this is Object
        superInterfaces - the JVM types of its implemented interfaces
        Throws:
        java.lang.IllegalArgumentException
      • removeClassInfo

        public void removeClassInfo​(java.lang.String cl)
        Delete the class information from the store.
      • iterateOverClasses

        public java.util.Iterator<java.lang.String> iterateOverClasses()
        Iterate through all classes in the store.
      • getSuperClass

        public java.lang.String getSuperClass​(java.lang.String cl)
        Specified by:
        getSuperClass in interface ClassHierarchyProvider
        Returns:
        the superclass of the given class, or null if the superclass is not known or cl is java.lang.Object
      • getSuperInterfaces

        public java.lang.String[] getSuperInterfaces​(java.lang.String cl)
        Specified by:
        getSuperInterfaces in interface ClassHierarchyProvider
        Returns:
        the superinterfaces of the given class, or null if they are not known
      • getSubClasses

        public java.lang.String[] getSubClasses​(java.lang.String cl)
        Specified by:
        getSubClasses in interface ClassHierarchyProvider
        Returns:
        the complete set of direct subclasses or implementors of cl, or null if the complete set is not known
      • isInterface

        public int isInterface​(java.lang.String cl)
        Specified by:
        isInterface in interface ClassHierarchyProvider
        Returns:
        whether or not cl is an interface, or Constants.MAYBE if not known