Klasse SpoonUtil
java.lang.Object
de.firemage.autograder.core.integrated.SpoonUtil
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic booleanareLiteralsEqual(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 booleanisCompareToMethod(spoon.reflect.declaration.CtMethod<?> method) static booleanisEffectivelyFinal(StaticAnalysis staticAnalysis, spoon.reflect.declaration.CtField<?> field) static booleanisEqualsMethod(spoon.reflect.declaration.CtMethod<?> method) static booleanisGetter(spoon.reflect.declaration.CtMethod<?> method) static booleanisIntegerLiteral(spoon.reflect.code.CtExpression<?> expression, int value) static booleanisNullLiteral(spoon.reflect.code.CtExpression<?> expression) static booleanisPrimitiveNumeric(spoon.reflect.reference.CtTypeReference<?> type) static booleanisSetter(spoon.reflect.declaration.CtMethod<?> method) static booleanisStaticCallTo(spoon.reflect.code.CtInvocation<?> invocation, String typeName, String methodName) static booleanisString(spoon.reflect.reference.CtTypeReference<?> type) static booleanisStringLiteral(spoon.reflect.code.CtExpression<?> expression, String value) static Optional<spoon.reflect.reference.CtTypeReference<?>>isToStringCall(spoon.reflect.code.CtExpression<?> expression) static booleanisVoidMethod(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.CtStatementunwrapStatement(spoon.reflect.code.CtStatement statement)
-
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
-
tryGetBooleanLiteral
-
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
-
isEffectivelyFinal
public static boolean isEffectivelyFinal(StaticAnalysis staticAnalysis, spoon.reflect.declaration.CtField<?> field)
-