Package ch.grengine.code
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 Summary
Modifier and TypeMethodDescriptiongetBytecode(String className) gets the bytecode for the given class name.getClassNames(Source source) gets all class names of the given source.gets the set of all class names for which bytecode is in this code.longgetLastModifiedAtCompileTime(Source source) gets the last modified at compile time of the given source.getMainClassName(Source source) gets the main class name of the given source.gets the set of all sources which had been compiled to this code.gets the name of the originatingSourcesinstance, or a similar name that can help a human reader to identify the originating sources.booleanisForSource(Source source) returns true if the given source is for this code, i.e. had been part of the sources compiled to this code.toString()returns a string suitable for logging.
-
Method Details
-
getSourcesName
String getSourcesName()gets the name of the originatingSourcesinstance, or a similar name that can help a human reader to identify the originating sources.- Returns:
- sources name
- Since:
- 1.0
-
isForSource
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
gets the main class name of the given source.- Parameters:
source- source- Returns:
- main class name
- Throws:
NullPointerException- if the given source is nullIllegalArgumentException- if the given source is not for this code- Since:
- 1.0
-
getClassNames
gets all class names of the given source.- Parameters:
source- source- Returns:
- set of all class names
- Throws:
NullPointerException- if the given source is nullIllegalArgumentException- if the given source is not for this code- Since:
- 1.0
-
getLastModifiedAtCompileTime
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 nullIllegalArgumentException- if the given source is not for this code- Since:
- 1.0
-
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
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
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.
-