@Test public void delegateMethodExtraction() { testHelper.getPsiClass( psiClasses -> { Assert.assertNotNull(psiClasses); PsiClass cls = psiClasses.get(0); List<Class<? extends Annotation>> permittedParamAnnotations = new ArrayList<>(); permittedParamAnnotations.add(Event.class); ImmutableList<SpecMethodModel<DelegateMethod, Void>> delegateMethods = PsiDelegateMethodExtractor.getDelegateMethods( cls, new ArrayList<>( DelegateMethodDescriptions.LAYOUT_SPEC_DELEGATE_METHODS_MAP.keySet()), permittedParamAnnotations, ImmutableList.<Class<? extends Annotation>>of()); DelegateMethodExtractorTestHelper.assertDelegateMethodExtraction(delegateMethods); return true; }, "DelegateMethodExtractionClass.java"); }
public static ImmutableList<SpecMethodModel<DelegateMethod, Void>> getDelegateMethods( PsiClass psiClass, List<Class<? extends Annotation>> permittedMethodAnnotations, List<Class<? extends Annotation>> permittedInterStageInputAnnotations, List<Class<? extends Annotation>> delegateMethodAnnotationsThatSkipDiffModels) { final List<SpecMethodModel<DelegateMethod, Void>> delegateMethods = new ArrayList<>(); for (PsiMethod psiMethod : psiClass.getMethods()) { final List<Annotation> methodAnnotations = getMethodAnnotations(psiMethod, permittedMethodAnnotations); if (!methodAnnotations.isEmpty()) { final List<MethodParamModel> methodParams = getMethodParams( psiMethod, DelegateMethodExtractor.getPermittedMethodParamAnnotations( permittedInterStageInputAnnotations), permittedInterStageInputAnnotations, delegateMethodAnnotationsThatSkipDiffModels); final SpecMethodModel<DelegateMethod, Void> delegateMethod = new SpecMethodModel<>( ImmutableList.copyOf(methodAnnotations), PsiModifierExtractor.extractModifiers(psiMethod.getModifierList()), psiMethod.getName(), PsiTypeUtils.generateTypeSpec(psiMethod.getReturnType()), ImmutableList.<TypeVariableName>of(), ImmutableList.copyOf(methodParams), psiMethod, null); delegateMethods.add(delegateMethod); } } return ImmutableList.copyOf(delegateMethods); }
PsiDelegateMethodExtractor { public static ImmutableList<SpecMethodModel<DelegateMethod, Void>> getDelegateMethods( PsiClass psiClass, List<Class<? extends Annotation>> permittedMethodAnnotations, List<Class<? extends Annotation>> permittedInterStageInputAnnotations, List<Class<? extends Annotation>> delegateMethodAnnotationsThatSkipDiffModels) { final List<SpecMethodModel<DelegateMethod, Void>> delegateMethods = new ArrayList<>(); for (PsiMethod psiMethod : psiClass.getMethods()) { final List<Annotation> methodAnnotations = getMethodAnnotations(psiMethod, permittedMethodAnnotations); if (!methodAnnotations.isEmpty()) { final List<MethodParamModel> methodParams = getMethodParams( psiMethod, DelegateMethodExtractor.getPermittedMethodParamAnnotations( permittedInterStageInputAnnotations), permittedInterStageInputAnnotations, delegateMethodAnnotationsThatSkipDiffModels); final SpecMethodModel<DelegateMethod, Void> delegateMethod = new SpecMethodModel<>( ImmutableList.copyOf(methodAnnotations), PsiModifierExtractor.extractModifiers(psiMethod.getModifierList()), psiMethod.getName(), PsiTypeUtils.generateTypeSpec(psiMethod.getReturnType()), ImmutableList.<TypeVariableName>of(), ImmutableList.copyOf(methodParams), psiMethod, null); delegateMethods.add(delegateMethod); } } return ImmutableList.copyOf(delegateMethods); } }
PsiDelegateMethodExtractor { public static ImmutableList<SpecMethodModel<DelegateMethod, Void>> getDelegateMethods( PsiClass psiClass, List<Class<? extends Annotation>> permittedMethodAnnotations, List<Class<? extends Annotation>> permittedInterStageInputAnnotations, List<Class<? extends Annotation>> delegateMethodAnnotationsThatSkipDiffModels) { final List<SpecMethodModel<DelegateMethod, Void>> delegateMethods = new ArrayList<>(); for (PsiMethod psiMethod : psiClass.getMethods()) { final List<Annotation> methodAnnotations = getMethodAnnotations(psiMethod, permittedMethodAnnotations); if (!methodAnnotations.isEmpty()) { final List<MethodParamModel> methodParams = getMethodParams( psiMethod, DelegateMethodExtractor.getPermittedMethodParamAnnotations( permittedInterStageInputAnnotations), permittedInterStageInputAnnotations, delegateMethodAnnotationsThatSkipDiffModels); final SpecMethodModel<DelegateMethod, Void> delegateMethod = new SpecMethodModel<>( ImmutableList.copyOf(methodAnnotations), PsiModifierExtractor.extractModifiers(psiMethod.getModifierList()), psiMethod.getName(), PsiTypeUtils.generateTypeSpec(psiMethod.getReturnType()), ImmutableList.<TypeVariableName>of(), ImmutableList.copyOf(methodParams), psiMethod, null); delegateMethods.add(delegateMethod); } } return ImmutableList.copyOf(delegateMethods); }  }
PsiDelegateMethodExtractor { public static ImmutableList<SpecMethodModel<DelegateMethod, Void>> getDelegateMethods( PsiClass psiClass, List<Class<? extends Annotation>> permittedMethodAnnotations, List<Class<? extends Annotation>> permittedInterStageInputAnnotations, List<Class<? extends Annotation>> delegateMethodAnnotationsThatSkipDiffModels) { final List<SpecMethodModel<DelegateMethod, Void>> delegateMethods = new ArrayList<>(); for (PsiMethod psiMethod : psiClass.getMethods()) { final List<Annotation> methodAnnotations = getMethodAnnotations(psiMethod, permittedMethodAnnotations); if (!methodAnnotations.isEmpty()) { final List<MethodParamModel> methodParams = getMethodParams( psiMethod, DelegateMethodExtractor.getPermittedMethodParamAnnotations( permittedInterStageInputAnnotations), permittedInterStageInputAnnotations, delegateMethodAnnotationsThatSkipDiffModels); final SpecMethodModel<DelegateMethod, Void> delegateMethod = new SpecMethodModel<>( ImmutableList.copyOf(methodAnnotations), PsiModifierExtractor.extractModifiers(psiMethod.getModifierList()), psiMethod.getName(), PsiTypeUtils.generateTypeSpec(psiMethod.getReturnType()), ImmutableList.<TypeVariableName>of(), ImmutableList.copyOf(methodParams), psiMethod, null); delegateMethods.add(delegateMethod); } } return ImmutableList.copyOf(delegateMethods); }  static ImmutableList<SpecMethodModel<DelegateMethod, Void>> getDelegateMethods(
      PsiClass psiClass,
      List<Class<? extends Annotation>> permittedMethodAnnotations,
      List<Class<? extends Annotation>> permittedInterStageInputAnnotations,
      List<Class<? extends Annotation>> delegateMethodAnnotationsThatSkipDiffModels); }
PsiDelegateMethodExtractor { public static ImmutableList<SpecMethodModel<DelegateMethod, Void>> getDelegateMethods( PsiClass psiClass, List<Class<? extends Annotation>> permittedMethodAnnotations, List<Class<? extends Annotation>> permittedInterStageInputAnnotations, List<Class<? extends Annotation>> delegateMethodAnnotationsThatSkipDiffModels) { final List<SpecMethodModel<DelegateMethod, Void>> delegateMethods = new ArrayList<>(); for (PsiMethod psiMethod : psiClass.getMethods()) { final List<Annotation> methodAnnotations = getMethodAnnotations(psiMethod, permittedMethodAnnotations); if (!methodAnnotations.isEmpty()) { final List<MethodParamModel> methodParams = getMethodParams( psiMethod, DelegateMethodExtractor.getPermittedMethodParamAnnotations( permittedInterStageInputAnnotations), permittedInterStageInputAnnotations, delegateMethodAnnotationsThatSkipDiffModels); final SpecMethodModel<DelegateMethod, Void> delegateMethod = new SpecMethodModel<>( ImmutableList.copyOf(methodAnnotations), PsiModifierExtractor.extractModifiers(psiMethod.getModifierList()), psiMethod.getName(), PsiTypeUtils.generateTypeSpec(psiMethod.getReturnType()), ImmutableList.<TypeVariableName>of(), ImmutableList.copyOf(methodParams), psiMethod, null); delegateMethods.add(delegateMethod); } } return ImmutableList.copyOf(delegateMethods); }  static ImmutableList<SpecMethodModel<DelegateMethod, Void>> getDelegateMethods(
      PsiClass psiClass,
      List<Class<? extends Annotation>> permittedMethodAnnotations,
      List<Class<? extends Annotation>> permittedInterStageInputAnnotations,
      List<Class<? extends Annotation>> delegateMethodAnnotationsThatSkipDiffModels);  }