|
42 | 42 | import java.util.Set; |
43 | 43 | import java.util.function.Predicate; |
44 | 44 |
|
| 45 | +import static io.microsphere.annotation.processor.util.ConstructorUtils.findDeclaredConstructor; |
| 46 | +import static io.microsphere.annotation.processor.util.FieldUtils.findField; |
| 47 | +import static io.microsphere.annotation.processor.util.MethodUtils.findMethod; |
45 | 48 | import static io.microsphere.annotation.processor.util.TypeUtils.ofDeclaredType; |
46 | 49 | import static java.util.Collections.emptyList; |
47 | 50 | import static org.junit.jupiter.api.Assertions.assertSame; |
@@ -169,6 +172,21 @@ protected TypeElement getTypeElement(Type type) { |
169 | 172 | return TypeUtils.getTypeElement(processingEnv, type); |
170 | 173 | } |
171 | 174 |
|
| 175 | + protected VariableElement getField(Type type, String fieldName) { |
| 176 | + TypeElement typeElement = getTypeElement(type); |
| 177 | + return findField(typeElement, fieldName); |
| 178 | + } |
| 179 | + |
| 180 | + protected ExecutableElement getMethod(Type type, String methodName, Type... parameterTypes) { |
| 181 | + TypeElement typeElement = getTypeElement(type); |
| 182 | + return findMethod(typeElement, methodName, parameterTypes); |
| 183 | + } |
| 184 | + |
| 185 | + protected ExecutableElement getConstructor(Type type, Type... parameterTypes) { |
| 186 | + TypeElement typeElement = getTypeElement(type); |
| 187 | + return findDeclaredConstructor(typeElement, parameterTypes); |
| 188 | + } |
| 189 | + |
172 | 190 | protected Element[] getElements(Type... types) { |
173 | 191 | return getTypeMirrors(types).stream().map(TypeUtils::ofTypeElement).toArray(Element[]::new); |
174 | 192 | } |
|
0 commit comments