Class BaseSourceImpl
java.lang.Object
io.github.mmm.code.base.BasePathElementAccess
io.github.mmm.code.base.node.BaseNodeItemContainerAccess
io.github.mmm.code.base.AbstractBaseProvider
io.github.mmm.code.base.source.BaseSourceImpl
- All Implemented Interfaces:
io.github.mmm.code.api.CodeLoader, io.github.mmm.code.api.CodeProvider, io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.node.CodeContainer, io.github.mmm.code.api.node.CodeNode, io.github.mmm.code.api.node.CodeNodeWithFileWriting, io.github.mmm.code.api.object.CodeMutable, io.github.mmm.code.api.source.CodeSource, BaseProvider, BaseLoader, BaseSource, AutoCloseable
Implementation of
CodeSource for Java.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
Constructor Summary
ConstructorsConstructorDescriptionBaseSourceImpl(File byteCodeLocation, File sourceCodeLocation, String id, io.github.mmm.code.api.source.CodeSourceDescriptor descriptor, BaseSourceLoader loader) The constructor.BaseSourceImpl(CodeSource reflectiveObject, io.github.mmm.code.api.source.CodeSourceDescriptor descriptor, BaseSourceLoader loader) The constructor.BaseSourceImpl(CodeSource reflectiveObject, File byteCodeLocation, File sourceCodeLocation, String id, io.github.mmm.code.api.source.CodeSourceDescriptor descriptor, List<BaseSource> dependencies, BaseSourceLoader loader, boolean immutable) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected BaseSourceDependenciesprotected io.github.mmm.code.api.source.CodeSourceDescriptorprotected Fileio.github.mmm.code.api.source.CodeSourceDescriptorgetId()static StringgetNormalizedId(File location) static StringgetNormalizedId(CodeSource source) getType(io.github.mmm.code.api.CodeName qualifiedName) booleanstatic StringnormalizeId(String id) voidsetContext(BaseContext context) toString()voidvoidMethods inherited from class AbstractBaseProvider
getRequiredTypeMethods inherited from class BaseNodeItemContainerAccess
addContainerItemMethods inherited from class BasePathElementAccess
addPathElementInternal, getPackageMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface BaseProvider
getRequiredTypeMethods inherited from interface BaseSource
getSourceMethods inherited from interface io.github.mmm.code.api.object.CodeMutable
isMutableMethods inherited from interface io.github.mmm.code.api.CodeProvider
parseName
-
Constructor Details
-
BaseSourceImpl
public BaseSourceImpl(File byteCodeLocation, File sourceCodeLocation, String id, io.github.mmm.code.api.source.CodeSourceDescriptor descriptor, BaseSourceLoader loader) The constructor.- Parameters:
byteCodeLocation- thebyte code location.sourceCodeLocation- thesource code location.id- theID.descriptor- thedescriptor.loader- theloader.
-
BaseSourceImpl
public BaseSourceImpl(CodeSource reflectiveObject, io.github.mmm.code.api.source.CodeSourceDescriptor descriptor, BaseSourceLoader loader) The constructor.- Parameters:
reflectiveObject- thereflective object. May not benullotherwise use different constructor.descriptor- thedescriptor.loader- theloader.
-
BaseSourceImpl
public BaseSourceImpl(CodeSource reflectiveObject, File byteCodeLocation, File sourceCodeLocation, String id, io.github.mmm.code.api.source.CodeSourceDescriptor descriptor, List<BaseSource> dependencies, BaseSourceLoader loader, boolean immutable) The constructor.- Parameters:
reflectiveObject- thereflective object. May not benullotherwise use different constructor.byteCodeLocation- thebyte code location.sourceCodeLocation- thesource code location.id- theID.descriptor- thedescriptor.dependencies- thegetDependencies()dependencies.loader- theloader.immutable- theimmutableflag.
-
-
Method Details
-
isImmutable
public boolean isImmutable()- Specified by:
isImmutablein interfaceio.github.mmm.code.api.object.CodeMutable
-
normalizeId
-
getNormalizedId
-
getNormalizedId
- Parameters:
source- theCodeSourcewith to the location of the code that shall be used asID.- Returns:
- the normalized
ID.
-
getContext
- Specified by:
getContextin interfaceBaseLoader- Specified by:
getContextin interfaceBaseProvider- Specified by:
getContextin interfaceBaseSource- Specified by:
getContextin interfaceio.github.mmm.code.api.CodeWithContext
-
setContext
- Parameters:
context- the initialcontext.
-
getRootPackage
- Specified by:
getRootPackagein interfaceBaseSource- Specified by:
getRootPackagein interfaceio.github.mmm.code.api.source.CodeSource
-
getLoader
- Specified by:
getLoaderin interfaceBaseSource- Returns:
- the
BaseSourceLoaderto loadBasePackages andBaseTypes.
-
getReflectiveObject
- Specified by:
getReflectiveObjectin interfaceio.github.mmm.code.api.source.CodeSource
-
getParent
- Specified by:
getParentin interfaceBaseSource- Specified by:
getParentin interfaceio.github.mmm.code.api.node.CodeNode- Specified by:
getParentin interfaceio.github.mmm.code.api.source.CodeSource
-
getDescriptor
public io.github.mmm.code.api.source.CodeSourceDescriptor getDescriptor()- Specified by:
getDescriptorin interfaceio.github.mmm.code.api.source.CodeSource
-
createDescriptor
protected io.github.mmm.code.api.source.CodeSourceDescriptor createDescriptor()- Returns:
- the lazily created
CodeSourceDescriptor. Method will be called only once.
-
getDependencies
- Specified by:
getDependenciesin interfaceBaseSource- Specified by:
getDependenciesin interfaceio.github.mmm.code.api.source.CodeSource
-
createDependencies
- Returns:
- the lazily created
BaseSourceDependencies. Method will be called only once.
-
getByteCodeLocation
- Specified by:
getByteCodeLocationin interfaceio.github.mmm.code.api.source.CodeSource
-
getSourceCodeLocation
- Specified by:
getSourceCodeLocationin interfaceio.github.mmm.code.api.source.CodeSource
-
createSourceCodeLocation
- Returns:
- the lazily created
source code location. Method will be called only once.
-
getId
- Specified by:
getIdin interfaceio.github.mmm.code.api.source.CodeSource
-
getType
- Specified by:
getTypein interfaceBaseLoader- Specified by:
getTypein interfaceio.github.mmm.code.api.CodeLoader- Specified by:
getTypein interfaceio.github.mmm.code.api.source.CodeSource- Overrides:
getTypein classAbstractBaseProvider
-
getType
- Specified by:
getTypein interfaceBaseLoader- Specified by:
getTypein interfaceBaseProvider- Specified by:
getTypein interfaceio.github.mmm.code.api.CodeLoader- Specified by:
getTypein interfaceio.github.mmm.code.api.source.CodeSource
-
getType
- Specified by:
getTypein interfaceBaseLoader- Specified by:
getTypein interfaceio.github.mmm.code.api.CodeLoader- Specified by:
getTypein interfaceio.github.mmm.code.api.source.CodeSource- Parameters:
clazz- theClassto get asCodeGenericType.- Returns:
- the existing or otherwise newly created
CodeGenericType. Typically aCodeTypebut may also be aarray typein case anarraywas given.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceio.github.mmm.code.api.CodeProvider
-
toString
-
write
- Specified by:
writein interfaceio.github.mmm.code.api.node.CodeNodeWithFileWriting
-
write
-