Class StringSourceInfo

java.lang.Object
de.firemage.autograder.core.file.StringSourceInfo
All Implemented Interfaces:
SourceInfo, Serializable

public final class StringSourceInfo extends Object implements SourceInfo
See Also:
  • Method Details

    • fromSourceString

      public static SourceInfo fromSourceString(JavaVersion version, String className, String source)
    • fromSourceStrings

      public static SourceInfo fromSourceStrings(JavaVersion version, Map<String,String> sources)
    • compilationUnits

      public List<CompilationUnit> compilationUnits()
      Description copied from interface: SourceInfo
      Returns the compilation units of the source.

      All compilation units must be relative to the root of the source returned by SourceInfo.path().

      Specified by:
      compilationUnits in interface SourceInfo
      Returns:
      the compilation units of the source or an empty list if there are none
    • copyTo

      public SourceInfo copyTo(Path target) throws IOException
      Description copied from interface: SourceInfo
      Copies the source to the given target directory.
      Specified by:
      copyTo in interface SourceInfo
      Parameters:
      target - the target directory, which must be accessible
      Returns:
      a new SourceInfo representing the copied source
      Throws:
      IOException - if the copy failed
    • path

      public Path path()
      Description copied from interface: SourceInfo
      Returns a path to the source, which might not exist on the file-system.

      For example, one could have the entire code in memory, so there would be no path on the file-system.

      Specified by:
      path in interface SourceInfo
      Returns:
      a path to the source
    • getSpoonResource

      public spoon.compiler.SpoonResource getSpoonResource()
      Specified by:
      getSpoonResource in interface SourceInfo
    • getVersion

      public JavaVersion getVersion()
      Description copied from interface: SourceInfo
      Returns the java version required to compile the source.
      Specified by:
      getVersion in interface SourceInfo
      Returns:
      the java version required to compile the source