Class AbstractBaseContextWithCache
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.AbstractBaseContext
io.github.mmm.code.base.AbstractBaseContextWithCache
- All Implemented Interfaces:
io.github.mmm.code.api.CodeContext, io.github.mmm.code.api.CodeLoader, io.github.mmm.code.api.CodeProvider, io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.node.CodeNode, BaseContext, BaseProvider, BaseLoader, AutoCloseable
Extends
AbstractBaseContext with caching to speed up lookups.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
Constructor Summary
ConstructorsConstructorDescriptionThe constructor.AbstractBaseContextWithCache(BaseSourceImpl source, BaseSourceProvider sourceProvider) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected <K,V> Map <K, V> protected abstract BaseLoadergetOrCreateSource(File byteCodeLocation, File sourceCodeLocation) This is an internal method that should only be used from implementations ofBaseSourceProvider.getOrCreateSource(String id, Supplier<BaseSource> sourceSupplier) Attention: This is an internal method that shall not be used from outside.protected BaseSourcegetOrCreateSource(CodeSource codeSource) getOrCreateType(String qualifiedName, boolean add) getType(io.github.mmm.code.api.CodeName qName) protected BaseTypegetTypeFromCache(String qualifiedName) protected booleanMethods inherited from class AbstractBaseContext
createChildContext, getBooleanType, getContext, getFactory, getLanguage, getNonPrimitiveType, getParent, getQualifiedNameForStandardType, getRootEnumerationType, getRootExceptionType, getRootType, getSource, getUnboundedWildcard, getVoidTypeMethods 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, toString, wait, wait, waitMethods inherited from interface BaseContext
getRootContext, getTypeMethods inherited from interface BaseProvider
getRequiredTypeMethods inherited from interface io.github.mmm.code.api.CodeContext
getQualifiedName, getQualifiedNameMethods inherited from interface io.github.mmm.code.api.CodeProvider
parseName
-
Constructor Details
-
AbstractBaseContextWithCache
The constructor.- Parameters:
source- the top-levelsource.
-
AbstractBaseContextWithCache
The constructor.- Parameters:
source- the top-levelsource.sourceProvider- theBaseSourceProvider.
-
-
Method Details
-
createCache
-
getLoader
- Returns:
- the
BaseLoaderto loadBaseTypes.
-
getOrCreateType
-
getType
- Specified by:
getTypein interfaceBaseLoader- Specified by:
getTypein interfaceio.github.mmm.code.api.CodeLoader- Overrides:
getTypein classAbstractBaseProvider
-
getType
-
getType
-
getTypeFromCache
- Overrides:
getTypeFromCachein classAbstractBaseContext- Parameters:
qualifiedName- thequalified nameof the requestedCodeType.- Returns:
- the requested
CodeTypefrom the cache ornullif not in cache.
-
getOrCreateSource
This is an internal method that should only be used from implementations ofBaseSourceProvider.- Parameters:
byteCodeLocation- thebyte code location.sourceCodeLocation- thesource code location.- Returns:
- the existing or otherwise created
BaseSource.
-
getOrCreateSource
- Parameters:
codeSource- theCodeSource.- Returns:
- the existing or otherwise created
BaseSource.
-
getOrCreateSource
Attention: This is an internal method that shall not be used from outside. UsegetSource(String)instead.- Parameters:
id- theIDof the requested source.sourceSupplier- theSupplierused as factory tocreatethe source if it does not already exist.- Returns:
- the existing
BaseSourcefor the givenID.
-
isPreventRegisterSource
protected boolean isPreventRegisterSource()- Returns:
trueifgetOrCreateSource(String, Supplier)may not be called to register a new source,falseotherwise.
-
getSource
- Specified by:
getSourcein interfaceBaseContext- Overrides:
getSourcein classAbstractBaseContext- Parameters:
id- theIDof the requested source.- Returns:
- the existing
BaseSourcefor the givenIDornullif not found.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceio.github.mmm.code.api.CodeProvider- Overrides:
closein classAbstractBaseContext
-