Interface CodeSource
- All Superinterfaces:
AutoCloseable, CodeContainer, CodeLoader, CodeMutable, CodeNode, CodeNodeWithFileWriting, CodeProvider, CodeWithContext
public interface CodeSource
extends CodeProvider, CodeContainer, CodeNodeWithFileWriting, CodeMutable
- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
Method Summary
Modifier and TypeMethodDescriptiongetId()ATTENTION:
When callinggetTypemethods onCodeSourceyou will only be able to retrieveCodeTypes from exactly this source.ATTENTION:
When callinggetTypemethods onCodeSourceyou will only be able to retrieveCodeTypes from exactly this source.ATTENTION:
When callinggetTypemethods onCodeSourceyou will only be able to retrieveCodeTypes from exactly this source.Methods inherited from interface CodeMutable
isImmutable, isMutableMethods inherited from interface CodeNodeWithFileWriting
write, writeMethods inherited from interface CodeProvider
close, getRequiredType, parseNameMethods inherited from interface CodeWithContext
getContext, getSource
-
Method Details
-
getRootPackage
CodePackage getRootPackage()- Returns:
- the root
packageof this source. Will typically be lazy initialized andtraversal(especiallyCodePathElements.getDeclared()) can be expensive. Results will however be cached to speed up subsequent calls.
-
getDependencies
CodeSourceDependencies<?> getDependencies()- Returns:
- the
CodeSourceDependenciescontainingCodeSources that are the parents of this source. These can be considered of the dependencies of this source (like in Maven, Gradle, Yarn, etc.)
-
getParent
CodeSource getParent()- Specified by:
getParentin interfaceCodeNode- Returns:
- the first parent from
getDependencies()ornullif theparentsare empty. In the latter case this is the root source (in Java from system classloader with the JDK code).
-
getId
String getId()- Returns:
- the unique ID of this source. May be the
string representationof thebyteorsource code location.
-
getByteCodeLocation
-
getSourceCodeLocation
-
getDescriptor
CodeSourceDescriptor getDescriptor()- Returns:
- the
CodeSourceDescriptorof this source.
-
getReflectiveObject
CodeSource getReflectiveObject()- Returns:
- see
CodeMutableItem.getReflectiveObject().
-
getType
ATTENTION:
When callinggetTypemethods onCodeSourceyou will only be able to retrieveCodeTypes from exactly this source. This should only be used in very specific situations (e.g. if you only want to retrieve code from main or test locations of a maven project). In most cases you want to useCodeLoader.getType(String)instead.- Specified by:
getTypein interfaceCodeLoader- Parameters:
qualifiedName- thequalified nameof the requestedCodeType.- Returns:
- the requested
CodeTypeornullif not found.
-
getType
ATTENTION:
When callinggetTypemethods onCodeSourceyou will only be able to retrieveCodeTypes from exactly this source. This should only be used in very specific situations (e.g. if you only want to retrieve code from main or test locations of a maven project). In most cases you want to useCodeLoader.getType(Class)instead. This method makes only sense for Java. For otherCodeLanguages please ignore this method.- Specified by:
getTypein interfaceCodeLoader- Parameters:
clazz- theClassto get asCodeGenericType.- Returns:
- the existing or otherwise newly created
CodeGenericType. Typically aCodeTypebut may also be aarray typein case anarraywas given.
-
getType
ATTENTION:
When callinggetTypemethods onCodeSourceyou will only be able to retrieveCodeTypes from exactly this source. This should only be used in very specific situations (e.g. if you only want to retrieve code from main or test locations of a maven project). In most cases you want to useCodeLoader.getType(CodeName)instead.- Specified by:
getTypein interfaceCodeLoader- Parameters:
qualifiedName- theCodeNameof the requestedCodeType.- Returns:
- the requested
CodeTypeornullif not found.
-