Package ch.grengine.code
Class DefaultSingleSourceCode
java.lang.Object
ch.grengine.code.DefaultSingleSourceCode
- All Implemented Interfaces:
Code,SingleSourceCode
Default implementation of
SingleSourceCode with all bytecode in memory.- Since:
- 1.0
- Author:
- Alain Stalder, Made in Switzerland.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSingleSourceCode(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.gets all class names for the single source.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.longgets the last modified at compile time for the single source.longgetLastModifiedAtCompileTime(Source source) gets the last modified at compile time of the given source.gets the main class name for the single source.getMainClassName(Source source) gets the main class name of the given source.gets the 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
-
DefaultSingleSourceCode
public DefaultSingleSourceCode(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 nullIllegalArgumentException- if not for a single source- 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
-
getMainClassName
Description copied from interface:SingleSourceCodegets the main class name for the single source.- Specified by:
getMainClassNamein interfaceSingleSourceCode- 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
-
getClassNames
Description copied from interface:SingleSourceCodegets all class names for the single source.- Specified by:
getClassNamesin interfaceSingleSourceCode- Returns:
- 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
-
getLastModifiedAtCompileTime
public long getLastModifiedAtCompileTime()Description copied from interface:SingleSourceCodegets the last modified at compile time for the single source.- Specified by:
getLastModifiedAtCompileTimein interfaceSingleSourceCode- 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
-
getSource
Description copied from interface:SingleSourceCodegets the source.- Specified by:
getSourcein interfaceSingleSourceCode- Returns:
- source
-
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.
-