diff --git a/libraries/pom.xml b/libraries/pom.xml index d067525315..602f3a991e 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -1,902 +1,911 @@ - - - 4.0.0 - libraries - libraries - - - parent-modules - com.baeldung - 1.0.0-SNAPSHOT - - - - - - com.typesafe.akka - akka-actor_2.12 - ${typesafe-akka.version} - - - - com.typesafe.akka - akka-testkit_2.12 - ${typesafe-akka.version} - test - - - - - org.asynchttpclient - async-http-client - ${async.http.client.version} - - - - org.beykery - neuroph - ${neuroph.version} - - - - cglib - cglib - ${cglib.version} - - - - com.opencsv - opencsv - ${opencsv.version} - - - org.apache.commons - commons-lang3 - ${commons-lang.version} - - - commons-net - commons-net - ${commons-net.version} - - - tec.units - unit-ri - ${unit-ri.version} - - - org.jasypt - jasypt - ${jasypt.version} - - - org.javatuples - javatuples - ${javatuples.version} - - - org.javassist - javassist - ${javaassist.version} - - - - org.assertj - assertj-core - ${assertj.version} - - - org.skyscreamer - jsonassert - ${jsonassert.version} - - - org.javers - javers-core - ${javers.version} - - - - io.nats - jnats - ${jnats.version} - - - - rome - rome - ${rome.version} - - - io.specto - hoverfly-java - ${hoverfly-java.version} - - - org.apache.httpcomponents - httpclient - ${httpclient.version} - - - commons-logging - commons-logging - - - - - net.serenity-bdd - serenity-core - ${serenity.version} - test - - - org.asciidoctor - asciidoctorj - - - - - net.serenity-bdd - serenity-junit - ${serenity.version} - test - - - net.serenity-bdd - serenity-jbehave - ${serenity.jbehave.version} - test - - - net.serenity-bdd - serenity-rest-assured - ${serenity.version} - test - - - net.serenity-bdd - serenity-jira-requirements-provider - ${serenity.jira.version} - test - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - - - org.datanucleus - javax.jdo - ${javax.jdo.version} - - - org.datanucleus - datanucleus-core - ${datanucleus.version} - - - org.datanucleus - datanucleus-api-jdo - ${datanucleus.version} - - - org.datanucleus - datanucleus-rdbms - ${datanucleus.version} - - - org.datanucleus - datanucleus-maven-plugin - ${datanucleus-maven-plugin.version} - - - org.datanucleus - datanucleus-xml - ${datanucleus-xml.version} - - - org.datanucleus - datanucleus-jdo-query - ${datanucleus-jdo-query.version} - - - net.openhft - chronicle - ${chronicle.version} - - - com.sun.java - tools - - - - - org.springframework - spring-web - ${spring.version} - - - net.serenity-bdd - serenity-spring - ${serenity.version} - test - - - net.serenity-bdd - serenity-screenplay - ${serenity.version} - test - - - net.serenity-bdd - serenity-screenplay-webdriver - ${serenity.version} - test - - - - - org.lucee - jets3t - ${jets3t-version} - - - org.lucee - commons-codec - ${commons-codec-version} - - - - io.rest-assured - spring-mock-mvc - ${spring-mock-mvc.version} - test - - - org.multiverse - multiverse-core - ${multiverse.version} - - - com.zaxxer - HikariCP - ${HikariCP.version} - compile - - - com.h2database - h2 - ${h2.version} - - - pl.pragmatists - JUnitParams - ${jUnitParams.version} - test - - - org.quartz-scheduler - quartz - ${quartz.version} - - - one.util - streamex - ${streamex.version} - - - org.jooq - jool - ${jool.version} - - - org.openjdk.jmh - jmh-core - ${jmh.version} - - - org.openjdk.jmh - jmh-generator-annprocess - ${jmh.version} - - - junit - junit - ${junit.version} - test - - - info.debatty - java-lsh - ${java-lsh.version} - - - au.com.dius - pact-jvm-consumer-junit_2.11 - ${pact.version} - test - - - org.codehaus.groovy - groovy-all - pom - ${groovy.version} - - - org.awaitility - awaitility - ${awaitility.version} - test - - - org.awaitility - awaitility-proxy - ${awaitility.version} - test - - - org.hamcrest - java-hamcrest - ${org.hamcrest.java-hamcrest.version} - test - - - net.agkn - hll - ${hll.version} - - - net.bytebuddy - byte-buddy - ${bytebuddy.version} - - - net.bytebuddy - byte-buddy-agent - ${bytebuddy.version} - - - org.pcollections - pcollections - ${pcollections.version} - - - com.machinezoo.noexception - noexception - ${noexception.version} - - - org.eclipse.collections - eclipse-collections - ${eclipse-collections.version} - - - io.vavr - vavr - ${vavr.version} - - - - - com.squareup.retrofit2 - retrofit - ${retrofit.version} - - - com.squareup.retrofit2 - converter-gson - ${retrofit.version} - - - com.squareup.retrofit2 - adapter-rxjava - ${retrofit.version} - - - com.squareup.okhttp3 - logging-interceptor - ${logging-interceptor.version} - - - com.darwinsys - hirondelle-date4j - ${hirondelle-date4j.version} - - - com.haulmont.yarg - yarg - ${yarg.version} - - - net.engio - mbassador - ${mbassador.version} - - - org.jdeferred - jdeferred-core - ${jdeferred.version} - - - com.codepoetics - protonpack - ${protonpack.version} - - - org.functionaljava - functionaljava - ${functionaljava.version} - - - org.functionaljava - functionaljava-java8 - ${functionaljava.version} - - - org.functionaljava - functionaljava-quickcheck - ${functionaljava.version} - - - org.functionaljava - functionaljava-java-core - ${functionaljava.version} - - - javax.cache - cache-api - ${cache.version} - - - com.hazelcast - hazelcast - ${hazelcast.version} - - - org.jgrapht - jgrapht-core - ${jgrapht.version} - - - com.netopyr.wurmloch - wurmloch-crdt - ${crdt.version} - - - org.docx4j - docx4j - ${docx4j.version} - - - javax.xml.bind - jaxb-api - ${jaxb-api.version} - - - com.github.ben-manes.caffeine - caffeine - ${caffeine.version} - - - org.bouncycastle - bcprov-jdk15on - ${bouncycastle.version} - - - org.bouncycastle - bcpkix-jdk15on - ${bouncycastle.version} - - - com.google.http-client - google-http-client - ${googleclient.version} - - - com.google.http-client - google-http-client-jackson2 - ${googleclient.version} - - - com.google.http-client - google-http-client-gson - ${googleclient.version} - - - org.infinispan - infinispan-core - ${infinispan.version} - - - - - com.github.docker-java - docker-java - ${docker.version} - - - org.slf4j - slf4j-log4j12 - - - org.slf4j - jcl-over-slf4j - - - ch.qos.logback - logback-classic - - - - - com.sun.jersey - jersey-client - ${jersey.version} - - - - - - com.google.api-client - google-api-client - ${google-api.version} - - - com.google.oauth-client - google-oauth-client-jetty - ${google-api.version} - - - com.google.apis - google-api-services-sheets - ${google-sheets.version} - - - org.apache.kafka - kafka-streams - ${kafka.version} - - - org.apache.kafka - kafka-clients - ${kafka.version} - - - org.slf4j - slf4j-log4j12 - - - - - org.apache.kafka - kafka-clients - ${kafka.version} - test - test - - - - org.milyn - milyn-smooks-all - ${smooks.version} - - - com.mashape.unirest - unirest-java - ${unirest.version} - - - - - io.javalin - javalin - ${javalin.version} - - - - io.atlassian.fugue - fugue - ${fugue.version} - - - - org.jctools - jctools-core - ${jctools.version} - - - - - io.github.resilience4j - resilience4j-circuitbreaker - ${resilience4j.version} - - - io.github.resilience4j - resilience4j-ratelimiter - ${resilience4j.version} - - - io.github.resilience4j - resilience4j-bulkhead - ${resilience4j.version} - - - io.github.resilience4j - resilience4j-retry - ${resilience4j.version} - - - io.github.resilience4j - resilience4j-cache - ${resilience4j.version} - - - io.github.resilience4j - resilience4j-timelimiter - ${resilience4j.version} - - - com.squareup - javapoet - ${javapoet.version} - - - org.hamcrest - hamcrest-all - ${hamcrest-all.version} - test - - - - org.yaml - snakeyaml - ${snakeyaml.version} - - - - com.numericalmethod - suanshu - ${suanshu.version} - - - - org.derive4j - derive4j - ${derive4j.version} - true - - - org.mockftpserver - MockFtpServer - ${mockftpserver.version} - test - - - - - - - - false - - bintray-cuba-platform-main - bintray - http://dl.bintray.com/cuba-platform/main - - - Apache Staging - https://repository.apache.org/content/groups/staging - - - nm-repo - Numerical Method's Maven Repository - http://repo.numericalmethod.com/maven/ - default - - - - - - - - maven-failsafe-plugin - ${maven-failsafe-plugin.version} - - - chromedriver - - - - - net.serenity-bdd.maven.plugins - serenity-maven-plugin - ${serenity.plugin.version} - - - serenity-reports - post-integration-test - - aggregate - - - - - - - org.datanucleus - datanucleus-maven-plugin - ${datanucleus-maven-plugin.version} - - JDO - ${basedir}/datanucleus.properties - ${basedir}/log4j.properties - true - false - - - - - process-classes - - enhance - - - - - - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - **/log4j.properties - - - - com.baeldung.neuroph.NeurophXOR - - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.2 - - - package - - shade - - - benchmarks - - - org.openjdk.jmh.Main - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - - - - 4.0.0 - 1.21 - 1.23.0 - 0.1.0 - 0.7.0 - 3.2.7 - 3.6 - 1.9.2 - 1.2 - 3.21.0-GA - 3.6.2 - 1.5.0 - 3.1.0 - 4.5.3 - 1.4.196 - 1.0 - - 4.5.3 - 2.9.7 - 2.92 - 1.9.26 - 1.41.0 - 1.9.0 - 1.9.27 - 1.1.0 - 4.12 - 0.10 - 3.5.0 - 3.0.0 - 2.0.0.0 - 1.6.0 - 1.7.1 - 2.1.2 - 1.0 - 8.2.0 - 0.6.5 - 0.9.0 - 15.2 - 1.5.1 - 2.3.0 - 2.10 - 1.5.1 - 1.15 - 1.0.3 - 1.0.0 - 3.10.2 - 2.5.5 - 1.23.0 - v4-rev493-1.21.0 - 2.0.0 - 1.7.0 - 3.0.14 - 2.2.0 - 9.1.5.Final - 4.1 - 1.4.9 - 2.1.2 - 1.10.L001 - 0.9.4.0006L - 2.1.2 - 2.5.11 - 0.12.1 - 1.10.0 - 1.3 - 0.8.1 - 3.2.0-m7 - 5.1.1 - 5.0.2 - 5.0.0-release - 5.0.2 - 3.6.4 - 4.3.8.RELEASE - 3.0.3 - 2.6.3 - 2.3.0 - 0.9.12 - 1.19 - 2.5.2 - 1.1.0 - 3.9.0 - 2.0.4 - 1.3.1 - 1.2.6 - 4.8.1 - 1.0.1 - 3.3.5 - 2.1 - 1.58 - 1.19.4 - 1.6.0 - 4.5.1 - 3.3.0 - 3.0.2 - 1.1.0 - 2.7.1 - 3.6 - - - + + + 4.0.0 + libraries + libraries + + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + + + + + + com.typesafe.akka + akka-actor_2.12 + ${typesafe-akka.version} + + + + com.typesafe.akka + akka-testkit_2.12 + ${typesafe-akka.version} + test + + + + + org.asynchttpclient + async-http-client + ${async.http.client.version} + + + + org.beykery + neuroph + ${neuroph.version} + + + + cglib + cglib + ${cglib.version} + + + + com.opencsv + opencsv + ${opencsv.version} + + + org.apache.commons + commons-lang3 + ${commons-lang.version} + + + commons-net + commons-net + ${commons-net.version} + + + tec.units + unit-ri + ${unit-ri.version} + + + org.jasypt + jasypt + ${jasypt.version} + + + org.javatuples + javatuples + ${javatuples.version} + + + org.javassist + javassist + ${javaassist.version} + + + + org.assertj + assertj-core + ${assertj.version} + + + org.skyscreamer + jsonassert + ${jsonassert.version} + + + org.javers + javers-core + ${javers.version} + + + + io.nats + jnats + ${jnats.version} + + + + rome + rome + ${rome.version} + + + io.specto + hoverfly-java + ${hoverfly-java.version} + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + + + commons-logging + commons-logging + + + + + net.serenity-bdd + serenity-core + ${serenity.version} + test + + + org.asciidoctor + asciidoctorj + + + + + net.serenity-bdd + serenity-junit + ${serenity.version} + test + + + net.serenity-bdd + serenity-jbehave + ${serenity.jbehave.version} + test + + + net.serenity-bdd + serenity-rest-assured + ${serenity.version} + test + + + net.serenity-bdd + serenity-jira-requirements-provider + ${serenity.jira.version} + test + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + + org.datanucleus + javax.jdo + ${javax.jdo.version} + + + org.datanucleus + datanucleus-core + ${datanucleus.version} + + + org.datanucleus + datanucleus-api-jdo + ${datanucleus.version} + + + org.datanucleus + datanucleus-rdbms + ${datanucleus.version} + + + org.datanucleus + datanucleus-maven-plugin + ${datanucleus-maven-plugin.version} + + + org.datanucleus + datanucleus-xml + ${datanucleus-xml.version} + + + org.datanucleus + datanucleus-jdo-query + ${datanucleus-jdo-query.version} + + + net.openhft + chronicle + ${chronicle.version} + + + com.sun.java + tools + + + + + org.springframework + spring-web + ${spring.version} + + + net.serenity-bdd + serenity-spring + ${serenity.version} + test + + + net.serenity-bdd + serenity-screenplay + ${serenity.version} + test + + + net.serenity-bdd + serenity-screenplay-webdriver + ${serenity.version} + test + + + + + org.lucee + jets3t + ${jets3t-version} + + + org.lucee + commons-codec + ${commons-codec-version} + + + + io.rest-assured + spring-mock-mvc + ${spring-mock-mvc.version} + test + + + org.multiverse + multiverse-core + ${multiverse.version} + + + com.zaxxer + HikariCP + ${HikariCP.version} + compile + + + com.h2database + h2 + ${h2.version} + + + pl.pragmatists + JUnitParams + ${jUnitParams.version} + test + + + org.quartz-scheduler + quartz + ${quartz.version} + + + one.util + streamex + ${streamex.version} + + + org.jooq + jool + ${jool.version} + + + org.openjdk.jmh + jmh-core + ${jmh.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} + + + junit + junit + ${junit.version} + test + + + info.debatty + java-lsh + ${java-lsh.version} + + + au.com.dius + pact-jvm-consumer-junit_2.11 + ${pact.version} + test + + + org.codehaus.groovy + groovy-all + pom + ${groovy.version} + + + org.awaitility + awaitility + ${awaitility.version} + test + + + org.awaitility + awaitility-proxy + ${awaitility.version} + test + + + org.hamcrest + java-hamcrest + ${org.hamcrest.java-hamcrest.version} + test + + + net.agkn + hll + ${hll.version} + + + net.bytebuddy + byte-buddy + ${bytebuddy.version} + + + net.bytebuddy + byte-buddy-agent + ${bytebuddy.version} + + + org.pcollections + pcollections + ${pcollections.version} + + + com.machinezoo.noexception + noexception + ${noexception.version} + + + org.eclipse.collections + eclipse-collections + ${eclipse-collections.version} + + + io.vavr + vavr + ${vavr.version} + + + + + com.squareup.retrofit2 + retrofit + ${retrofit.version} + + + com.squareup.retrofit2 + converter-gson + ${retrofit.version} + + + com.squareup.retrofit2 + adapter-rxjava + ${retrofit.version} + + + com.squareup.okhttp3 + logging-interceptor + ${logging-interceptor.version} + + + com.darwinsys + hirondelle-date4j + ${hirondelle-date4j.version} + + + com.haulmont.yarg + yarg + ${yarg.version} + + + net.engio + mbassador + ${mbassador.version} + + + org.jdeferred + jdeferred-core + ${jdeferred.version} + + + com.codepoetics + protonpack + ${protonpack.version} + + + org.functionaljava + functionaljava + ${functionaljava.version} + + + org.functionaljava + functionaljava-java8 + ${functionaljava.version} + + + org.functionaljava + functionaljava-quickcheck + ${functionaljava.version} + + + org.functionaljava + functionaljava-java-core + ${functionaljava.version} + + + javax.cache + cache-api + ${cache.version} + + + com.hazelcast + hazelcast + ${hazelcast.version} + + + org.jgrapht + jgrapht-core + ${jgrapht.version} + + + com.netopyr.wurmloch + wurmloch-crdt + ${crdt.version} + + + org.docx4j + docx4j + ${docx4j.version} + + + javax.xml.bind + jaxb-api + ${jaxb-api.version} + + + com.github.ben-manes.caffeine + caffeine + ${caffeine.version} + + + org.bouncycastle + bcprov-jdk15on + ${bouncycastle.version} + + + org.bouncycastle + bcpkix-jdk15on + ${bouncycastle.version} + + + com.google.http-client + google-http-client + ${googleclient.version} + + + com.google.http-client + google-http-client-jackson2 + ${googleclient.version} + + + com.google.http-client + google-http-client-gson + ${googleclient.version} + + + org.infinispan + infinispan-core + ${infinispan.version} + + + + + com.github.docker-java + docker-java + ${docker.version} + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + jcl-over-slf4j + + + ch.qos.logback + logback-classic + + + + + com.sun.jersey + jersey-client + ${jersey.version} + + + + + + com.google.api-client + google-api-client + ${google-api.version} + + + com.google.oauth-client + google-oauth-client-jetty + ${google-api.version} + + + com.google.apis + google-api-services-sheets + ${google-sheets.version} + + + org.apache.kafka + kafka-streams + ${kafka.version} + + + org.apache.kafka + kafka-clients + ${kafka.version} + + + org.slf4j + slf4j-log4j12 + + + + + org.apache.kafka + kafka-clients + ${kafka.version} + test + test + + + + org.milyn + milyn-smooks-all + ${smooks.version} + + + com.mashape.unirest + unirest-java + ${unirest.version} + + + + + io.javalin + javalin + ${javalin.version} + + + + io.atlassian.fugue + fugue + ${fugue.version} + + + + org.jctools + jctools-core + ${jctools.version} + + + + + io.github.resilience4j + resilience4j-circuitbreaker + ${resilience4j.version} + + + io.github.resilience4j + resilience4j-ratelimiter + ${resilience4j.version} + + + io.github.resilience4j + resilience4j-bulkhead + ${resilience4j.version} + + + io.github.resilience4j + resilience4j-retry + ${resilience4j.version} + + + io.github.resilience4j + resilience4j-cache + ${resilience4j.version} + + + io.github.resilience4j + resilience4j-timelimiter + ${resilience4j.version} + + + com.squareup + javapoet + ${javapoet.version} + + + org.hamcrest + hamcrest-all + ${hamcrest-all.version} + test + + + + org.yaml + snakeyaml + ${snakeyaml.version} + + + + com.numericalmethod + suanshu + ${suanshu.version} + + + + org.derive4j + derive4j + ${derive4j.version} + true + + + org.mockftpserver + MockFtpServer + ${mockftpserver.version} + test + + + + + org.reflections + reflections + ${reflections.version} + + + + + + + + + false + + bintray-cuba-platform-main + bintray + http://dl.bintray.com/cuba-platform/main + + + Apache Staging + https://repository.apache.org/content/groups/staging + + + nm-repo + Numerical Method's Maven Repository + http://repo.numericalmethod.com/maven/ + default + + + + + + + + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + chromedriver + + + + + net.serenity-bdd.maven.plugins + serenity-maven-plugin + ${serenity.plugin.version} + + + serenity-reports + post-integration-test + + aggregate + + + + + + + org.datanucleus + datanucleus-maven-plugin + ${datanucleus-maven-plugin.version} + + JDO + ${basedir}/datanucleus.properties + ${basedir}/log4j.properties + true + false + + + + + process-classes + + enhance + + + + + + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + **/log4j.properties + + + + com.baeldung.neuroph.NeurophXOR + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.2 + + + package + + shade + + + benchmarks + + + org.openjdk.jmh.Main + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + + + + + + 4.0.0 + 1.21 + 1.23.0 + 0.1.0 + 0.7.0 + 3.2.7 + 3.6 + 1.9.2 + 1.2 + 3.21.0-GA + 3.6.2 + 1.5.0 + 3.1.0 + 4.5.3 + 1.4.196 + 1.0 + + 4.5.3 + 2.9.7 + 2.92 + 1.9.26 + 1.41.0 + 1.9.0 + 1.9.27 + 1.1.0 + 4.12 + 0.10 + 3.5.0 + 3.0.0 + 2.0.0.0 + 1.6.0 + 1.7.1 + 2.1.2 + 1.0 + 8.2.0 + 0.6.5 + 0.9.0 + 15.2 + 1.5.1 + 2.3.0 + 2.10 + 1.5.1 + 1.15 + 1.0.3 + 1.0.0 + 3.10.2 + 2.5.5 + 1.23.0 + v4-rev493-1.21.0 + 2.0.0 + 1.7.0 + 3.0.14 + 2.2.0 + 9.1.5.Final + 4.1 + 1.4.9 + 2.1.2 + 1.10.L001 + 0.9.4.0006L + 2.1.2 + 2.5.11 + 0.12.1 + 1.10.0 + 1.3 + 0.8.1 + 3.2.0-m7 + 5.1.1 + 5.0.2 + 5.0.0-release + 5.0.2 + 3.6.4 + 4.3.8.RELEASE + 3.0.3 + 2.6.3 + 2.3.0 + 0.9.12 + 1.19 + 2.5.2 + 1.1.0 + 3.9.0 + 2.0.4 + 1.3.1 + 1.2.6 + 4.8.1 + 1.0.1 + 3.3.5 + 2.1 + 1.58 + 1.19.4 + 1.6.0 + 4.5.1 + 3.3.0 + 3.0.2 + 1.1.0 + 2.7.1 + 3.6 + 0.9.11 + + + \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/reflections/ReflectionsApp.java b/libraries/src/main/java/com/baeldung/reflections/ReflectionsApp.java new file mode 100644 index 0000000000..30da8ea837 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/reflections/ReflectionsApp.java @@ -0,0 +1,71 @@ +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/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java b/libraries/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java new file mode 100644 index 0000000000..9a3ef0747b --- /dev/null +++ b/libraries/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java @@ -0,0 +1,50 @@ +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()); + } +}