Class DefaultCode

java.lang.Object
ch.grengine.code.DefaultCode
All Implemented Interfaces:
Code

public class DefaultCode extends Object implements Code
Default implementation of Code with all bytecode in memory.
Since:
1.0
Author:
Alain Stalder, Made in Switzerland.
  • Constructor Details

  • Method Details

    • getSourcesName

      public String getSourcesName()
      Description copied from interface: Code
      gets the name of the originating Sources instance, or a similar name that can help a human reader to identify the originating sources.
      Specified by:
      getSourcesName in interface Code
      Returns:
      sources name
    • isForSource

      public boolean isForSource(Source source)
      Description copied from interface: Code
      returns true if the given source is for this code, i.e. had been part of the sources compiled to this code.
      Specified by:
      isForSource in interface Code
      Parameters:
      source - source
      Returns:
      true if given source is for this code
    • getMainClassName

      public String getMainClassName(Source source)
      Description copied from interface: Code
      gets the main class name of the given source.
      Specified by:
      getMainClassName in interface Code
      Parameters:
      source - source
      Returns:
      main class name
    • getClassNames

      public Set<String> getClassNames(Source source)
      Description copied from interface: Code
      gets all class names of the given source.
      Specified by:
      getClassNames in interface Code
      Parameters:
      source - source
      Returns:
      set of all class names
    • getLastModifiedAtCompileTime

      public long getLastModifiedAtCompileTime(Source source)
      Description copied from interface: Code
      gets the last modified at compile time of the given source.
      Specified by:
      getLastModifiedAtCompileTime in interface Code
      Parameters:
      source - source
      Returns:
      last modified at compile time
    • getSourceSet

      public Set<Source> getSourceSet()
      Description copied from interface: Code
      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.

      Specified by:
      getSourceSet in interface Code
      Returns:
      set of all sources which had been compiled to this code
    • getBytecode

      public Bytecode getBytecode(String className)
      Description copied from interface: Code
      gets the bytecode for the given class name.
      Specified by:
      getBytecode in interface Code
      Parameters:
      className - class name
      Returns:
      bytecode or null if not found
    • getClassNameSet

      public Set<String> getClassNameSet()
      Description copied from interface: Code
      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.

      Specified by:
      getClassNameSet in interface Code
      Returns:
      set of all class names for which bytecode is in this code
    • toString

      public String toString()
      Description copied from interface: Code
      returns a string suitable for logging.
      Specified by:
      toString in interface Code
      Overrides:
      toString in class Object
      Returns:
      a string suitable for logging