Class SpoonUtils

java.lang.Object
org.tudalgo.algoutils.tutor.general.SpoonUtils

public class SpoonUtils extends Object
A collection of utilities for working with spoon.
  • Method Details

    • getCtElementForSourceCode

      public static <T, U extends spoon.reflect.declaration.CtType<?>> T getCtElementForSourceCode(String ignoredSourceCode, Class<U> ignoredKind, Matcher<Stringifiable> ignoredNameMatcher)
      Deprecated.
    • getNameOfCtElement

      public static String getNameOfCtElement(spoon.reflect.declaration.CtElement element)

      Returns a human-readable name of the given element.

      Parameters:
      element - the element
      Returns:
      the human-readable name
    • getNameOfCtElement

      public static String getNameOfCtElement(Class<?> type)

      Returns a human-readable name of the given element type.

      Parameters:
      type - the element type
      Returns:
      the human-readable name
    • getCtModel

      public static spoon.reflect.CtModel getCtModel()
      Deprecated.

      Returns a CtModel for submission.

      If the test run is a test cycle run, the class loader of the test cycle is used to load the submission.

      Returns:
      the CtModel
      See Also:
      • TestCycleResolver
    • getType

      public static spoon.reflect.declaration.CtType<?> getType(String className)
      Returns the corresponding CtType in the spoon world for the given class.
      Parameters:
      className - the class to get the spoon type for
      Returns:
      the corresponding CtType in the spoon world for the given class
    • getType

      public static <T extends spoon.reflect.declaration.CtType<?>> T getType(String className, Class<T> type)
      Returns the corresponding CtType in the spoon world for the given class.
      Type Parameters:
      T - the type of the spoon type to return
      Parameters:
      className - the class to get the spoon type for
      type - the type of the spoon type to return
      Returns:
      the corresponding CtType in the spoon world for the given class