diff --git a/libraries-6/src/main/java/com/baeldung/reflections/ReflectionsApp.java b/libraries-6/src/main/java/com/baeldung/reflections/ReflectionsApp.java deleted file mode 100644 index 4f5b6dd183..0000000000 --- a/libraries-6/src/main/java/com/baeldung/reflections/ReflectionsApp.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.baeldung.reflections; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.Date; -import java.util.Set; -import java.util.regex.Pattern; - -import org.reflections.Reflections; -import org.reflections.scanners.MethodAnnotationsScanner; -import org.reflections.scanners.MethodParameterScanner; -import org.reflections.scanners.ResourcesScanner; -import org.reflections.scanners.Scanner; -import org.reflections.scanners.SubTypesScanner; -import org.reflections.util.ClasspathHelper; -import org.reflections.util.ConfigurationBuilder; - -public class ReflectionsApp { - - public Set> getReflectionsSubTypes() { - Reflections reflections = new Reflections("org.reflections"); - Set> scannersSet = reflections.getSubTypesOf(Scanner.class); - return scannersSet; - } - - public Set> getJDKFunctinalInterfaces() { - Reflections reflections = new Reflections("java.util.function"); - Set> typesSet = reflections.getTypesAnnotatedWith(FunctionalInterface.class); - return typesSet; - } - - public Set getDateDeprecatedMethods() { - Reflections reflections = new Reflections(java.util.Date.class, new MethodAnnotationsScanner()); - Set deprecatedMethodsSet = reflections.getMethodsAnnotatedWith(Deprecated.class); - return deprecatedMethodsSet; - } - - @SuppressWarnings("rawtypes") - public Set getDateDeprecatedConstructors() { - Reflections reflections = new Reflections(java.util.Date.class, new MethodAnnotationsScanner()); - Set constructorsSet = reflections.getConstructorsAnnotatedWith(Deprecated.class); - return constructorsSet; - } - - public Set getMethodsWithDateParam() { - Reflections reflections = new Reflections(java.text.SimpleDateFormat.class, new MethodParameterScanner()); - Set methodsSet = reflections.getMethodsMatchParams(Date.class); - return methodsSet; - } - - public Set getMethodsWithVoidReturn() { - Reflections reflections = new Reflections(java.text.SimpleDateFormat.class, new MethodParameterScanner()); - Set methodsSet = reflections.getMethodsReturn(void.class); - return methodsSet; - } - - public Set getPomXmlPaths() { - Reflections reflections = new Reflections(new ResourcesScanner()); - Set resourcesSet = reflections.getResources(Pattern.compile(".*pom\\.xml")); - return resourcesSet; - } - - public Set> getReflectionsSubTypesUsingBuilder() { - Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("org.reflections")) - .setScanners(new SubTypesScanner())); - - Set> scannersSet = reflections.getSubTypesOf(Scanner.class); - return scannersSet; - } - -} diff --git a/libraries-6/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java b/libraries-6/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java deleted file mode 100644 index b86094b6f4..0000000000 --- a/libraries-6/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baeldung.reflections; - -import static org.junit.jupiter.api.Assertions.assertFalse; - -import org.junit.jupiter.api.Test; - -public class ReflectionsUnitTest { - - @Test - public void givenTypeThenGetAllSubTypes() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getReflectionsSubTypes() - .isEmpty()); - } - - @Test - public void givenTypeAndUsingBuilderThenGetAllSubTypes() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getReflectionsSubTypesUsingBuilder() - .isEmpty()); - } - - @Test - public void givenAnnotationThenGetAllAnnotatedMethods() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getDateDeprecatedMethods() - .isEmpty()); - } - - @Test - public void givenAnnotationThenGetAllAnnotatedConstructors() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getDateDeprecatedConstructors() - .isEmpty()); - } - - @Test - public void givenParamTypeThenGetAllMethods() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getMethodsWithDateParam() - .isEmpty()); - } - - @Test - public void givenReturnTypeThenGetAllMethods() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getMethodsWithVoidReturn() - .isEmpty()); - } -} diff --git a/libraries-jdk8/README.md b/libraries-jdk8/README.md index 1aefc54289..fa2126c89a 100644 --- a/libraries-jdk8/README.md +++ b/libraries-jdk8/README.md @@ -1,4 +1,4 @@ -## Libraries-7 +## Libraries-jdk8 This module contains articles about various Java libraries. These are small libraries that are relatively easy to use and do not require any separate module of their own.