Package ch.grengine.code
Class DefaultCode
java.lang.Object
ch.grengine.code.DefaultCode
- All Implemented Interfaces:
Code
Default implementation of
Code with all bytecode in memory.- Since:
- 1.0
- Author:
- Alain Stalder, Made in Switzerland.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCode(String sourcesName, Map<Source, CompiledSourceInfo> compiledSourceInfoMap, Map<String, Bytecode> bytecodeMap) constructor (typically called by the compiler). -
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.
-
Constructor Details
-
DefaultCode
public DefaultCode(String sourcesName, Map<Source, CompiledSourceInfo> compiledSourceInfoMap, Map<String, Bytecode> bytecodeMap) constructor (typically called by the compiler).- Parameters:
sourcesName- the name of the originatingSourcesinstancecompiledSourceInfoMap- the map of originatingSourcetoCompiledSourceInfobytecodeMap- the map of class name toBytecode- Throws:
NullPointerException- if any argument is null- Since:
- 1.0
-
-
Method Details
-
getSourcesName
Description copied from interface:Codegets the name of the originatingSourcesinstance, or a similar name that can help a human reader to identify the originating sources.- Specified by:
getSourcesNamein interfaceCode- Returns:
- sources name
-
isForSource
Description copied from interface:Codereturns true if the given source is for this code, i.e. had been part of the sources compiled to this code.- Specified by:
isForSourcein interfaceCode- Parameters:
source- source- Returns:
- true if given source is for this code
-
getMainClassName
Description copied from interface:Codegets the main class name of the given source.- Specified by:
getMainClassNamein interfaceCode- Parameters:
source- source- Returns:
- main class name
-
getClassNames
Description copied from interface:Codegets all class names of the given source.- Specified by:
getClassNamesin interfaceCode- Parameters:
source- source- Returns:
- set of all class names
-
getLastModifiedAtCompileTime
Description copied from interface:Codegets the last modified at compile time of the given source.- Specified by:
getLastModifiedAtCompileTimein interfaceCode- Parameters:
source- source- Returns:
- last modified at compile time
-
getSourceSet
Description copied from interface:Codegets 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:
getSourceSetin interfaceCode- Returns:
- set of all sources which had been compiled to this code
-
getBytecode
Description copied from interface:Codegets the bytecode for the given class name.- Specified by:
getBytecodein interfaceCode- Parameters:
className- class name- Returns:
- bytecode or null if not found
-
getClassNameSet
Description copied from interface:Codegets 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:
getClassNameSetin interfaceCode- Returns:
- set of all class names for which bytecode is in this code
-
toString
Description copied from interface:Codereturns a string suitable for logging.
-