Questions tagged [reflections]

For questions about the Java Reflections library (org.reflections.reflections) by ronmamo, which performs Java runtime metadata analysis, in the spirit of Scannotations.

Official GitHub Repository: https://github.com/ronmamo/reflections

155 questions
1
vote
0 answers

Reflections Library , unable to find any classes within my package

I am attempting to use the reflections library to get access to classes inside a package in my project. As per suggestions from the question below. Can you find all classes in a package using reflection? When running my method, size() on my set 0…
1
vote
1 answer

Guava ClassPath.from(MyClass.class.getClassLoader()).getTopLevelClassesRecursive("mypackage") returns 0 elements

In one of my projects I use Guava to get the class name from command line and then call appropriate constructor. User runs the .bat file with something like: java -jar MyClass.jar OtherClass OtherClass is located at some package like…
Helen
  • 347
  • 1
  • 4
  • 16
1
vote
0 answers

Google Reflections on Android not getting any classes

I'm trying to use Reflections library to get all classes annotated with a specific Java annotation. I included Reflections library in .gradle file: compile 'org.reflections:reflections:0.9.10' However, the library does not work for me on Android.…
1
vote
0 answers

org.reflections.Reflections cannot find my class (in relation the way I'm writing my lambda)

I'm working with GATK, a java tool for bioinformatics. It use org.reflections.Reflections under the hood to load some plugins. My plugin compiled but wasn't found/loaded by GATK while it was in the classpath and a similar tool was working without…
Pierre
  • 34,472
  • 31
  • 113
  • 192
1
vote
2 answers

Optaplanner - Error when running executable jar but works fine from eclipse

I use eclipse for my optaplanner project development and I am able to execute my code from eclipse without any problem. To make this project as an executable, I exported it as a jar file using eclipse export wizard. Then I run my jar from terminal…
Selva
  • 951
  • 7
  • 23
1
vote
2 answers

Configurating Interface to use with Framework

I'm currently developing a framework where I'll provide an Interface that the user should implement in his application for configuration purposes. The user should ne able to implement a getTargetUsername() that will be used in the framework…
adolfosrs
  • 9,286
  • 5
  • 39
  • 67
1
vote
0 answers

Google-Reflections : When should reflections library be used? and How to create dynamic POJO from table metadata?

I am a hibernate learner. I have came to know about google-reflections library when I was researching on how to make dynamic POJO class when Only Table and schema name is provided i.e. try { sessionFactory = new…
yashpal bharadwaj
  • 323
  • 2
  • 6
  • 14
1
vote
1 answer

How to dynamically scan Annotated classes using google Reflections?

In refrence to this. I am making an hibernate demo in which I want to map all the POJO classes dynamically. I found the above given reference and tried to scan my classes from the package mapping only. But it is giving some errors like: Exception in…
yashpal bharadwaj
  • 323
  • 2
  • 6
  • 14
1
vote
0 answers

Scala how to get annotated classes

In Java i can use org.reflections for scanning packages and searching annotated classes. Like this: Reflections ref = new Reflections("my.path"); Set> set = ref.getTypesAnnotatedWith(MyAnnotation.class); How to get annotated classes in…
Boris T
  • 11
  • 1
1
vote
1 answer

Using Gradle to save all Reflections metadata

There's a snippet that shows how to save all Reflections metadata at build time so bootstrapping time is reduced here. The problem is it uses Maven and I want to do this with Gradle. Could anyone please help me to convert this Maven configuration to…
nikoliazekter
  • 757
  • 2
  • 6
  • 23
1
vote
1 answer

How to find all (child) sub-interfaces of a particular interface in Java?

Given an interface: public interface A {}; with inheriting interfaces: public interface B extends A {} public interface C extends A {} How can I programmatically scan to find B and C? I.e. how to do this: Type[] types = findAllSubInterfacesOfA();…
Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
1
vote
0 answers

How can I find all methods with a given annotation in a Jboss application?

I'm trying to find all methods annotated with a given annotation across a bunch of packages in a Jboss application. Here's some code: Reflections reflections = new Reflections( new ConfigurationBuilder().setUrls( …
Chris
  • 1,231
  • 1
  • 17
  • 35
1
vote
1 answer

Getting the path to a .class file of a dynamically loaded Class in JAVA

I'm looking to instantiate and map all classes in my class path of a given type. I've done the scan using the Reflections library, and got a list of classes that were loaded. Then, when I'm mapping them, I'm checking for conflicts (the key is…
ronif
  • 695
  • 1
  • 6
  • 14
1
vote
1 answer

ConfigurationBuilder,FilterBuilder,Scanners in java reflection

I am not able to find much documentation about ConfigurationBuilder,FilterBuilder,Scanners in java reflection. Can someone explain me what is there use case ?
Rohit Jain
  • 159
  • 1
  • 4
  • 12
1
vote
1 answer

Google Reflections object doesn't instance

I'm trying to make a class that calls certain instances of an object according to the value of my custom annotation, to it found that, Google Reflection is a good option but I can not instantiate it, what am I doing wrong? I try public class…
deFreitas
  • 4,196
  • 2
  • 33
  • 43