Class 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

public class BaseSourceImpl extends AbstractBaseProvider implements BaseSource
Implementation of CodeSource for Java.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

  • Method Details

    • isImmutable

      public boolean isImmutable()
      Specified by:
      isImmutable in interface io.github.mmm.code.api.object.CodeMutable
    • normalizeId

      public static String normalizeId(String id)
      Parameters:
      id - the raw ID.
      Returns:
      the normalized ID.
    • getNormalizedId

      public static String getNormalizedId(File location)
      Parameters:
      location - the File pointing to the location of the code that shall be used as ID.
      Returns:
      the normalized ID.
    • getNormalizedId

      public static String getNormalizedId(CodeSource source)
      Parameters:
      source - the CodeSource with to the location of the code that shall be used as ID.
      Returns:
      the normalized ID.
    • getContext

      public BaseContext getContext()
      Specified by:
      getContext in interface BaseLoader
      Specified by:
      getContext in interface BaseProvider
      Specified by:
      getContext in interface BaseSource
      Specified by:
      getContext in interface io.github.mmm.code.api.CodeWithContext
    • setContext

      public void setContext(BaseContext context)
      Parameters:
      context - the initial context.
    • getRootPackage

      public BasePackage getRootPackage()
      Specified by:
      getRootPackage in interface BaseSource
      Specified by:
      getRootPackage in interface io.github.mmm.code.api.source.CodeSource
    • getLoader

      public BaseSourceLoader getLoader()
      Specified by:
      getLoader in interface BaseSource
      Returns:
      the BaseSourceLoader to load BasePackages and BaseTypes.
    • getReflectiveObject

      public CodeSource getReflectiveObject()
      Specified by:
      getReflectiveObject in interface io.github.mmm.code.api.source.CodeSource
    • getParent

      public BaseSource getParent()
      Specified by:
      getParent in interface BaseSource
      Specified by:
      getParent in interface io.github.mmm.code.api.node.CodeNode
      Specified by:
      getParent in interface io.github.mmm.code.api.source.CodeSource
    • getDescriptor

      public io.github.mmm.code.api.source.CodeSourceDescriptor getDescriptor()
      Specified by:
      getDescriptor in interface io.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

      public BaseSourceDependencies getDependencies()
      Specified by:
      getDependencies in interface BaseSource
      Specified by:
      getDependencies in interface io.github.mmm.code.api.source.CodeSource
    • createDependencies

      protected BaseSourceDependencies createDependencies()
      Returns:
      the lazily created BaseSourceDependencies. Method will be called only once.
    • getByteCodeLocation

      public File getByteCodeLocation()
      Specified by:
      getByteCodeLocation in interface io.github.mmm.code.api.source.CodeSource
    • getSourceCodeLocation

      public File getSourceCodeLocation()
      Specified by:
      getSourceCodeLocation in interface io.github.mmm.code.api.source.CodeSource
    • createSourceCodeLocation

      protected File createSourceCodeLocation()
      Returns:
      the lazily created source code location. Method will be called only once.
    • getId

      public String getId()
      Specified by:
      getId in interface io.github.mmm.code.api.source.CodeSource
    • getType

      public BaseType getType(String qualifiedName)
      Specified by:
      getType in interface BaseLoader
      Specified by:
      getType in interface io.github.mmm.code.api.CodeLoader
      Specified by:
      getType in interface io.github.mmm.code.api.source.CodeSource
      Overrides:
      getType in class AbstractBaseProvider
    • getType

      public BaseType getType(io.github.mmm.code.api.CodeName qualifiedName)
      Specified by:
      getType in interface BaseLoader
      Specified by:
      getType in interface BaseProvider
      Specified by:
      getType in interface io.github.mmm.code.api.CodeLoader
      Specified by:
      getType in interface io.github.mmm.code.api.source.CodeSource
    • getType

      public BaseGenericType getType(Class<?> clazz)
      Specified by:
      getType in interface BaseLoader
      Specified by:
      getType in interface io.github.mmm.code.api.CodeLoader
      Specified by:
      getType in interface io.github.mmm.code.api.source.CodeSource
      Parameters:
      clazz - the Class to get as CodeGenericType.
      Returns:
      the existing or otherwise newly created CodeGenericType. Typically a CodeType but may also be a array type in case an array was given.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface io.github.mmm.code.api.CodeProvider
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • write

      public void write(Path targetFolder)
      Specified by:
      write in interface io.github.mmm.code.api.node.CodeNodeWithFileWriting
    • write

      public void write(Path targetFolder, Charset encoding)
      Specified by:
      write in interface io.github.mmm.code.api.node.CodeNodeWithFileWriting