Klasse SpoonUtil

java.lang.Object
de.firemage.autograder.core.integrated.SpoonUtil

public final class SpoonUtil extends Object
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    static boolean
    areLiteralsEqual(spoon.reflect.code.CtLiteral<?> left, spoon.reflect.code.CtLiteral<?> right)
     
    static <T> spoon.reflect.code.CtLiteral<T>
    getDefaultValue(spoon.reflect.reference.CtTypeReference<T> ty)
    Returns the default value of the given type.
    static List<spoon.reflect.code.CtStatement>
    getEffectiveStatements(spoon.reflect.code.CtBlock<?> block)
     
    static Optional<spoon.reflect.code.CtJavaDoc>
    getJavadoc(spoon.reflect.declaration.CtElement element)
     
    static spoon.reflect.code.CtVariableAccess<?>
    getVariableFromArray(spoon.reflect.code.CtArrayAccess<?,?> ctArrayAccess)
    Returns the variable from the array access.
    static boolean
    isCompareToMethod(spoon.reflect.declaration.CtMethod<?> method)
     
    static boolean
    isEffectivelyFinal(StaticAnalysis staticAnalysis, spoon.reflect.declaration.CtField<?> field)
     
    static boolean
    isEqualsMethod(spoon.reflect.declaration.CtMethod<?> method)
     
    static boolean
    isGetter(spoon.reflect.declaration.CtMethod<?> method)
     
    static boolean
    isIntegerLiteral(spoon.reflect.code.CtExpression<?> expression, int value)
     
    static boolean
    isNullLiteral(spoon.reflect.code.CtExpression<?> expression)
     
    static boolean
    isPrimitiveNumeric(spoon.reflect.reference.CtTypeReference<?> type)
     
    static boolean
    isSetter(spoon.reflect.declaration.CtMethod<?> method)
     
    static boolean
    isStaticCallTo(spoon.reflect.code.CtInvocation<?> invocation, String typeName, String methodName)
     
    static boolean
    isString(spoon.reflect.reference.CtTypeReference<?> type)
     
    static boolean
    isStringLiteral(spoon.reflect.code.CtExpression<?> expression, String value)
     
    static Optional<spoon.reflect.reference.CtTypeReference<?>>
    isToStringCall(spoon.reflect.code.CtExpression<?> expression)
     
    static boolean
    isVoidMethod(spoon.reflect.declaration.CtMethod<?> method)
     
    static <T> spoon.reflect.code.CtLiteral<T>
    makeLiteral(T value)
    Makes a new literal with the given value.
    tryGetBooleanLiteral(spoon.reflect.code.CtExpression<?> expression)
     
    static spoon.reflect.code.CtStatement
    unwrapStatement(spoon.reflect.code.CtStatement statement)
     

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Methodendetails

    • isString

      public static boolean isString(spoon.reflect.reference.CtTypeReference<?> type)
    • isToStringCall

      public static Optional<spoon.reflect.reference.CtTypeReference<?>> isToStringCall(spoon.reflect.code.CtExpression<?> expression)
    • isNullLiteral

      public static boolean isNullLiteral(spoon.reflect.code.CtExpression<?> expression)
    • isIntegerLiteral

      public static boolean isIntegerLiteral(spoon.reflect.code.CtExpression<?> expression, int value)
    • isStringLiteral

      public static boolean isStringLiteral(spoon.reflect.code.CtExpression<?> expression, String value)
    • tryGetBooleanLiteral

      public static Optional<Boolean> tryGetBooleanLiteral(spoon.reflect.code.CtExpression<?> expression)
    • areLiteralsEqual

      public static boolean areLiteralsEqual(spoon.reflect.code.CtLiteral<?> left, spoon.reflect.code.CtLiteral<?> right)
    • makeLiteral

      public static <T> spoon.reflect.code.CtLiteral<T> makeLiteral(T value)
      Makes a new literal with the given value.
      Typparameter:
      T - the type of the value
      Parameter:
      value - the value of the literal
      Gibt zurück:
      a new literal with the given value, note that the base is not set
    • getDefaultValue

      public static <T> spoon.reflect.code.CtLiteral<T> getDefaultValue(spoon.reflect.reference.CtTypeReference<T> ty)
      Returns the default value of the given type.
      Typparameter:
      T - the type of the value
      Parameter:
      ty - a reference to the type
      Gibt zurück:
      the default value of the given type
    • getVariableFromArray

      public static spoon.reflect.code.CtVariableAccess<?> getVariableFromArray(spoon.reflect.code.CtArrayAccess<?,?> ctArrayAccess)
      Returns the variable from the array access. For example array[0][1] will return array.
      Parameter:
      ctArrayAccess - the array access
      Gibt zurück:
      the variable
    • getEffectiveStatements

      public static List<spoon.reflect.code.CtStatement> getEffectiveStatements(spoon.reflect.code.CtBlock<?> block)
    • unwrapStatement

      public static spoon.reflect.code.CtStatement unwrapStatement(spoon.reflect.code.CtStatement statement)
    • isGetter

      public static boolean isGetter(spoon.reflect.declaration.CtMethod<?> method)
    • isSetter

      public static boolean isSetter(spoon.reflect.declaration.CtMethod<?> method)
    • isPrimitiveNumeric

      public static boolean isPrimitiveNumeric(spoon.reflect.reference.CtTypeReference<?> type)
    • isVoidMethod

      public static boolean isVoidMethod(spoon.reflect.declaration.CtMethod<?> method)
    • isEqualsMethod

      public static boolean isEqualsMethod(spoon.reflect.declaration.CtMethod<?> method)
    • isCompareToMethod

      public static boolean isCompareToMethod(spoon.reflect.declaration.CtMethod<?> method)
    • getJavadoc

      public static Optional<spoon.reflect.code.CtJavaDoc> getJavadoc(spoon.reflect.declaration.CtElement element)
    • isStaticCallTo

      public static boolean isStaticCallTo(spoon.reflect.code.CtInvocation<?> invocation, String typeName, String methodName)
    • isEffectivelyFinal

      public static boolean isEffectivelyFinal(StaticAnalysis staticAnalysis, spoon.reflect.declaration.CtField<?> field)