@Test public void extractNoFields() { testHelper.getPsiClass( psiClasses -> { Assert.assertNotNull(psiClasses); PsiClass psiClass = psiClasses.get(0); ImmutableList<FieldModel> fieldModels = PsiFieldsExtractor.extractFields(psiClass); FieldsExtractorTestHelper.noFieldExtraction(fieldModels); return true; }, "NoFieldsClass.java"); }
static ImmutableList<FieldModel> extractFields(PsiClass psiClass) { return Optional.of(psiClass) .map(PsiClass::getFields) .map(Arrays::stream) .map( fields -> fields .filter(Objects::nonNull) .map(PsiFieldsExtractor::createFieldModel) .collect(Collectors.toCollection(ArrayList::new))) .map(ImmutableList::copyOf) .orElse(ImmutableList.of()); }
PsiFieldsExtractor { static ImmutableList<FieldModel> extractFields(PsiClass psiClass) { return Optional.of(psiClass) .map(PsiClass::getFields) .map(Arrays::stream) .map( fields -> fields .filter(Objects::nonNull) .map(PsiFieldsExtractor::createFieldModel) .collect(Collectors.toCollection(ArrayList::new))) .map(ImmutableList::copyOf) .orElse(ImmutableList.of()); } }
PsiFieldsExtractor { static ImmutableList<FieldModel> extractFields(PsiClass psiClass) { return Optional.of(psiClass) .map(PsiClass::getFields) .map(Arrays::stream) .map( fields -> fields .filter(Objects::nonNull) .map(PsiFieldsExtractor::createFieldModel) .collect(Collectors.toCollection(ArrayList::new))) .map(ImmutableList::copyOf) .orElse(ImmutableList.of()); }  }
PsiFieldsExtractor { static ImmutableList<FieldModel> extractFields(PsiClass psiClass) { return Optional.of(psiClass) .map(PsiClass::getFields) .map(Arrays::stream) .map( fields -> fields .filter(Objects::nonNull) .map(PsiFieldsExtractor::createFieldModel) .collect(Collectors.toCollection(ArrayList::new))) .map(ImmutableList::copyOf) .orElse(ImmutableList.of()); }   }
PsiFieldsExtractor { static ImmutableList<FieldModel> extractFields(PsiClass psiClass) { return Optional.of(psiClass) .map(PsiClass::getFields) .map(Arrays::stream) .map( fields -> fields .filter(Objects::nonNull) .map(PsiFieldsExtractor::createFieldModel) .collect(Collectors.toCollection(ArrayList::new))) .map(ImmutableList::copyOf) .orElse(ImmutableList.of()); }    }