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

Can I use google reflections in a static section of code to find sub classes?

I am trying to set up a system that allows me to subclass a class that gets exported to a text file without having to modify the initial class. To do this, I am trying to build a list of callbacks that can tell if they handle a particular entry, and…
vextorspace
  • 934
  • 2
  • 10
  • 25
0
votes
1 answer

How to use Reflection to inspect non-static fields of a class that is loaded with a different ClassLoader?

I am using a child URLClassLoader to load an android.jar that can be found in the Android SDK (sdk/platforms/) at runtime, then I use the Google Reflections library to inspect the new classes I loaded. However, it seems that with the following code,…
Some Noob Student
  • 14,186
  • 13
  • 65
  • 103
0
votes
2 answers

Getting subclasses from Class

I have a project where the service interfaces are annotated with a @Service annotation (custom annotation, not Spring) and there can be multiple implementation for each service (hibernate, mongodb, etc). I am trying to load the implementation…
Jit B
  • 1,206
  • 14
  • 26
0
votes
1 answer

The dependency is missing from repository (error 404)

I'm trying to use the reflections-maven plugin in a project. However, Maven refuses to compile the project because the following dependency is…
Stephan
  • 41,764
  • 65
  • 238
  • 329
0
votes
2 answers

How Do I Scan for Annotation in Spring Web App Using Reflections Library (or other)

I have a web application built with Spring and running inside Jboss. I am trying, at runtime, to scan for classes that have a certain annotation. Right now I am using the open source Reflections library public static List
David Williams
  • 8,388
  • 23
  • 83
  • 171
0
votes
1 answer

strange output using Reflections utility

I am using the http://reflections.googlecode.com/ utility This is a method I am trying to execute // Only top level modules should be added to this list protected Set> discoverModulesOnClassPath() { // Scan classpath to…
Gautam
  • 1,030
  • 13
  • 37
0
votes
1 answer

On application start: cannot find methods marked with annotations, but ONLY in PROD mode. Why?

In my application I use an annotation to mark some methods that I want to be executed during the "onStart" hook of my application. My code is like this: @Override public void onStart(Application app) { Reflections reflections = new…
le-doude
  • 3,345
  • 2
  • 25
  • 55
0
votes
1 answer

Custom Java Based Gradle Plugin and Classpath of Consuming Projects

I have made a plugin with a task that will search the classpath for classes annotated with a specific annotation, using the Reflections library from google (here). However, when consuming the plugin and running the task, the current modules'…
Samuel Raghunath
  • 155
  • 1
  • 13
0
votes
3 answers

Play2War - could not create Vfs.Dir from url

I'm trying to deploy a Play 2.1.1 app onto Websphere 8.5.5 using Play2War. The app works fine when started with play ~run but when I deploy the war onto Websphere, I get this error message: org.reflections.ReflectionsException: could not create…
KevSheedy
  • 3,195
  • 4
  • 22
  • 26
0
votes
1 answer

List all interfaces in a package in a jar file

Hello stackoverflow'ers! I am trying to list all classes from an interface in a specific package. I came across multiple solutions and tried the following: Using Reflections: AllCommands = new ArrayList(); Reflections reflections = new…
Sven Mawby
  • 645
  • 6
  • 16
0
votes
1 answer

Using the Reflections library for querying resources in a given package ignoring subpackages

Using the Reflections library, how to obtain all the resources with a particular file extension located exactly in one package ? I tried with this code: ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setUrls(...); …
Sergio
  • 8,532
  • 11
  • 52
  • 94
0
votes
1 answer

Need to scan WEB-INF/lib/xxx-ejb.jar for Type and Method annotations

I want to do the following using Google Reflections: Scan only WEB-INF/lib/Patrac-ejb.jar Scan only the package com.patrac and all of its sub-packages. Scan for only type- and method annotations. The following configuration seems to work fine but…
Patrick Garner
  • 3,201
  • 6
  • 39
  • 58
0
votes
1 answer

Querying classes with arbitrary properties in Java classpath using the Reflections library

I have used in the past the Reflections library to query classes in my classpath having a particular annotation, or inheriting from a particular class. This is very easy to do with Reflections since the library already provide methods that answer…
Sergio
  • 8,532
  • 11
  • 52
  • 94
0
votes
1 answer

Finding classpath of class invoking a library

I am using google Reflections in a java library I am developing. The reason I use Reflections is because I want to find all the classes with a particular annotation. Simplifying things, in my library I have a method answering those classes, that is…
Sergio
  • 8,532
  • 11
  • 52
  • 94
-1
votes
1 answer

do a mock on Mocked object in Junit5

I am trying to write a test case in JUNIT5. I want to do unit test on the below class Class Service{ @Autowired ObjectHolder objectHolder; UtilityServiceDTOMapper serviceDTOMapper = objectHolder.getImplementation(); List recordList =…
F0cus
  • 585
  • 3
  • 18
  • 52
1 2 3
10
11