java.lang.Object
org.matwoess.jsourceprofiler.tool.model.JClass
All Implemented Interfaces:
Serializable, Component

public class JClass extends Object implements Serializable, Component
This class is used to store information about a java class.

Contains information about its name, the package, the parent class and the inner classes.

It also contains a list of methods and a list of class-level blocks.

See Also:
  • Field Details

    • name

      public String name
    • classType

      public ClassType classType
    • packageName

      public String packageName
    • parentClass

      public JClass parentClass
    • innerClasses

      public final List<JClass> innerClasses
    • methods

      public final List<Method> methods
    • classBlocks

      public final List<Block> classBlocks
  • Constructor Details

    • JClass

      public JClass(String name, ClassType type)
      Creates a new JClass with the given name and class type.
      Parameters:
      name - the name of the class
      type - the class type (one of ClassType)
  • Method Details

    • setParentClass

      public void setParentClass(JClass parentClass)
      Registers this class as a nested inner class of the given parent class.

      If the name is empty, it will be assigned a number based on the number of already registered anonymous classes.

      Parameters:
      parentClass - the containing parent class
    • getName

      public String getName()
      Returns the name of this class, including the parent class name if it is an inner class, separated by a $.
      Returns:
      the name of this class
    • getFullName

      public String getFullName()
      Returns the full name of this class, including the package name.
      Returns:
      the full name of this class
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getClassesRecursive

      public List<JClass> getClassesRecursive()
      Returns a list of all inner classes recursively.
      Returns:
      the list of child classes
    • getMethodsRecursive

      public List<Method> getMethodsRecursive()
      Returns a list of all methods in this class and all inner classes recursively.
      Returns:
      all methods in this class and all inner classes
    • getAggregatedMethodBlockCounts

      public long getAggregatedMethodBlockCounts()
      Returns the sum of hits for all method blocks in this class and all inner classes recursively.
      Returns:
      the total number of hits for any method is this top-level class
    • getBlocksRecursive

      public List<Block> getBlocksRecursive()
      Returns a list of all blocks in this class and all inner classes recursively.
      Returns:
      the list of all blocks contained inside this class
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object