Interface Code

All Known Subinterfaces:
SingleSourceCode
All Known Implementing Classes:
DefaultCode, DefaultSingleSourceCode

public interface Code
Interface for code from compiling an instance of Sources.

Contains bytecode and class names, as well as information related to the originating sources.

Since:
1.0
Author:
Alain Stalder, Made in Switzerland.
  • Method Details

    • getSourcesName

      String getSourcesName()
      gets the name of the originating Sources instance, or a similar name that can help a human reader to identify the originating sources.
      Returns:
      sources name
      Since:
      1.0
    • isForSource

      boolean isForSource(Source source)
      returns true if the given source is for this code, i.e. had been part of the sources compiled to this code.
      Parameters:
      source - source
      Returns:
      true if given source is for this code
      Throws:
      NullPointerException - if the given source is null
      Since:
      1.0
    • getMainClassName

      String getMainClassName(Source source)
      gets the main class name of the given source.
      Parameters:
      source - source
      Returns:
      main class name
      Throws:
      NullPointerException - if the given source is null
      IllegalArgumentException - if the given source is not for this code
      Since:
      1.0
    • getClassNames

      Set<String> getClassNames(Source source)
      gets all class names of the given source.
      Parameters:
      source - source
      Returns:
      set of all class names
      Throws:
      NullPointerException - if the given source is null
      IllegalArgumentException - if the given source is not for this code
      Since:
      1.0
    • getLastModifiedAtCompileTime

      long getLastModifiedAtCompileTime(Source source)
      gets the last modified at compile time of the given source.
      Parameters:
      source - source
      Returns:
      last modified at compile time
      Throws:
      NullPointerException - if the given source is null
      IllegalArgumentException - if the given source is not for this code
      Since:
      1.0
    • getSourceSet

      Set<Source> getSourceSet()
      gets the set of all sources which had been compiled to this code.

      Note that if code is not in memory, this operation may be slow or expensive in terms of resources.

      Returns:
      set of all sources which had been compiled to this code
      Since:
      1.0
    • getBytecode

      Bytecode getBytecode(String className)
      gets the bytecode for the given class name.
      Parameters:
      className - class name
      Returns:
      bytecode or null if not found
      Throws:
      NullPointerException - if the given class name is null
      Since:
      1.0
    • getClassNameSet

      Set<String> getClassNameSet()
      gets the set of all class names for which bytecode is in this code.

      Note that if code is not in memory, this operation may be slow or expensive in terms of resources.

      Returns:
      set of all class names for which bytecode is in this code
      Since:
      1.0
    • toString

      String toString()
      returns a string suitable for logging.
      Overrides:
      toString in class Object
      Returns:
      a string suitable for logging
      Since:
      1.0