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
0
votes
1 answer

Reflections in custom java gradle plugin

I have a gradle project with multiple modules, each built to it's own .jar file. I want to use reflections in a custom java gradle plugin, to generate a report on annotated classes/methods. /build.gradle apply plugin:…
G. Miller
  • 79
  • 1
  • 6
0
votes
2 answers

can someone help me to know jdk version compatibility on org.reflections.Reflections jar

I m using Reflections.jar for the first time, so i like to know the following Is there any version compatibility for this jar(like above jdk6 (or) upto jdk8) While loading classes is there any order of loading(like alphabetical order (or) order of…
sera
  • 27
  • 9
0
votes
0 answers

Find class marked with annotation of a specific value

I'm using this Java Reflections API that I'm finding quite convenient so far: https://github.com/ronmamo/reflections Find all classes marked with a specific annotation is dead easy, however, I can't figure out how to add a filter in the scanner to…
Khain
  • 875
  • 2
  • 8
  • 11
0
votes
1 answer

Using google reflections to load resource files

I am working on a JavaFX project and I my project structure is as follows. This is my Image I want to load *fxml files under /src/main/java/resources/view/primary in /src/main/java/windchimes.ui/WindChimesApplication.java using Google Refletions. I…
0
votes
1 answer

What driver are you expected to provide for Reflections.collect() to work from a Groovy script?

I have the following snippet of scratch code import com.google.appengine.api.datastore.Entity import org.reflections.Reflections Reflections r = Reflections.collect() Set> entities = r.getTypesAnnotatedWith(Entity.class) print…
user177800
0
votes
1 answer

Find the methods of a particular class matching an annotation

I have two annotations, we'll call them @Foo and @Bar. @Foo is a class (aka type)-level annotation and @Bar is a method-level annotation. My intent is for a given @Foo class, iterate over all the @Bar methods. What is the most appropriate way to do…
Peter
  • 1,032
  • 1
  • 11
  • 26
0
votes
1 answer

Java: Resolve method's generic type at runtime

How can I resolve this method's generic type at runtime? My method signature: static T get(String key) The method must remain static.
Jire
  • 9,680
  • 14
  • 52
  • 87
0
votes
0 answers

Constructor of Reflections not running correctly

I am using the Reflections library (see info) to get all classes within a package. I am just using the following code: public static void build() { System.out.println("Start reflection"); Reflections reflections = new…
bashoogzaad
  • 4,611
  • 8
  • 40
  • 65
0
votes
1 answer

In the OSGi/iPOJO world, how to get a list of instances of classes implementing an interface?

In the JavaEE/CDI world, I know how to have the list of instances of classes implementing a given interface : by using Instance combined with reflections library. But in the OSGI/iPOJO world, how to do so ? I know I get one instance by…
Riduidel
  • 22,052
  • 14
  • 85
  • 185
0
votes
4 answers

Java - determine where an object is instantiated from object's class

Say I have a class called MyClass, within this class, I want to find out the class name that instantiated an object of MyClass, for example: class MyClass { final String whoCreatedMe; public MyClass() { whoCreatedMe = ??? …
bohanl
  • 1,885
  • 4
  • 17
  • 33
0
votes
1 answer

google reflections not resolving my type parameters on annotated methods

I have the following code that works nicely if the project is in my classpath locally and I do a getClass().getClassLoader(). But when I try to load dynamically from an external jar it fails. It fails to load MyType, which is the type on the method…
grinder22
  • 551
  • 4
  • 17
0
votes
2 answers

Java reflections - seek a method with specific annotation and its annotation element

Suppose I have this annotation class @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface MethodXY { public int x(); public int y(); } public class AnnotationTest { @MethodXY(x=5, y=5) public void…
Mukund Jalan
  • 1,145
  • 20
  • 39
0
votes
0 answers

Problems searching for annotated classes using Reflections API

I'm having a very difficult time using the Reflections API to find classes that are annotated with a custom annotation at runtime. The ultimate goal is to find all classes in the project that are annotated with my custom @Job annotation, collect…
Shoeheart
  • 83
  • 1
  • 9
0
votes
1 answer

Google reflections on Websphere - Could not open url connection

I'm having a project in which I'm using google Reflections and deploying the project on websphere liberty profile. My project has the following code, the Transformer.class is location in a dependency jar private void bindTransformers(SimpleRegistry…
J2B
  • 1,703
  • 2
  • 16
  • 31
0
votes
0 answers

Google reflections not able to find classes when used through a maven plugin in a project

I am using google reflections in my maven plugin to get some classes with annotations. As in my project I gave only one url and it has 3 keys, but instead it is showing scanned 108 urls and 0 keys. What could be missing, I am using 0.9.9 version of…
chao
  • 9
  • 6