Package classycle

Class ClassAttributes

  • All Implemented Interfaces:
    Attributes, java.lang.Comparable<Attributes>

    public class ClassAttributes
    extends NameAndSourceAttributes
    Immutable class holding the attributes of a class vertex. They are
    • fully-qualified class name
    • type (interface, abstract, concrete, unknown)
    • flag innerClass
    • size of the class file
    Author:
    Franz-Josef Elmer
    • Constructor Detail

      • ClassAttributes

        public ClassAttributes​(java.lang.String name,
                               java.lang.String source,
                               java.lang.String type,
                               int size)
        Creates an instance based on the specified name, type, and size. The innerclass flag will be set if the name contains a '$' character.
        Parameters:
        name - Fully-qualified class name.
        source - Optional source of the class file. Can be null.
        type - Type.
        size - Size.
    • Method Detail

      • createInterface

        public static ClassAttributes createInterface​(java.lang.String name,
                                                      java.lang.String source,
                                                      int size)
        Creates an instance of the type INTERFACE.
        Parameters:
        name - Fully-qualified class name.
        source - Optional source of the class file. Can be null.
        size - Size of the class file.
        Returns:
        a new instance.
      • createAbstractClass

        public static ClassAttributes createAbstractClass​(java.lang.String name,
                                                          java.lang.String source,
                                                          int size)
        Creates an instance of the type ABSTRACT_CLASS.
        Parameters:
        name - Fully-qualified class name.
        source - Optional source of the class file. Can be null.
        size - Size of the class file.
        Returns:
        a new instance.
      • createClass

        public static ClassAttributes createClass​(java.lang.String name,
                                                  java.lang.String source,
                                                  int size)
        Creates an instance of the type CLASS.
        Parameters:
        name - Fully-qualified class name.
        source - Optional source of the class file. Can be null.
        size - Size of the class file.
        Returns:
        a new instance.
      • createUnknownClass

        public static ClassAttributes createUnknownClass​(java.lang.String name,
                                                         int size)
        Creates an instance of the type UNKNOWN.
        Parameters:
        name - Fully-qualified class name.
        size - Size of the class file.
        Returns:
        a new instance.
      • isInnerClass

        public boolean isInnerClass()
        Returns true in the case of an inner class.
      • getSize

        public int getSize()
        Returns the size of the class file in bytes.
        Specified by:
        getSize in class NameAttributes
      • toString

        public java.lang.String toString()
        Returns the attributes as a string for pretty printing.
        Overrides:
        toString in class java.lang.Object