Class SpoonUtils
java.lang.Object
org.tudalgo.algoutils.tutor.general.SpoonUtils
A collection of utilities for working with spoon.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,U extends spoon.reflect.declaration.CtType<?>>
TgetCtElementForSourceCode(String sourceCode, Class<U> kind, Matcher<Stringifiable> nameMatcher) Returns a CtElement of the specified type for the specified source code.static StringgetNameOfCtElement(Class<?> type) Returns a human-readable name of the given element type.static StringgetNameOfCtElement(spoon.reflect.declaration.CtElement element) Returns a human-readable name of the given element.
-
Method Details
-
getCtElementForSourceCode
public static <T,U extends spoon.reflect.declaration.CtType<?>> T getCtElementForSourceCode(String sourceCode, Class<U> kind, Matcher<Stringifiable> nameMatcher) Returns a CtElement of the specified type for the specified source code.
- Type Parameters:
T- the type of the element to return (subtype ofU)U- the type of the element to search for- Parameters:
sourceCode- the source codekind- the kind of the element to findnameMatcher- a matcher for matching the name of the element- Returns:
- the element
-
getNameOfCtElement
Returns a human-readable name of the given element.
- Parameters:
element- the element- Returns:
- the human-readable name
-
getNameOfCtElement
Returns a human-readable name of the given element type.
- Parameters:
type- the element type- Returns:
- the human-readable name
-