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

How to use reflections library to get subtype of a subtype

Here is my scenario, I have three classes: public abstract class A { public Set> getGrandChildren() { Reflections reflections = new Reflections(this.getClass().getPackage().getName()); Set> grandChildren =…
user2547836
  • 89
  • 1
  • 7
2
votes
2 answers

How do you use ReflectionUtils to get package private methods/fields?

I tried to get package private methods/field via Reflections like this: for (Method m : getAllMethods(cls, withModifier(Modifier.STATIC))){ but it is empty. Is there any way to filter by package private?
Enerccio
  • 257
  • 1
  • 10
  • 23
2
votes
2 answers

Reflections API not showing Interfaces having annotations

I am using the Reflections API to scan my java project and fetch all classes/interfaces having a particular annotation. However it is just returning classes but not interfaces. I am using the following: Set> annotated = …
PatSham
  • 33
  • 6
2
votes
2 answers

ClassLoader error with Reflecions 0.9.9-RC1 in Weblogic11g

I have a problem deploying an EAR application on Weblogic 10.3.5 using Reflections 0.9.9-RC1 jar. With default classloader (weblogic.utils.classloaders.ChangeAwareClassLoader@396e8d0 finder: weblogic.utils.classloaders.CodeGenClassFinder@5bcfadd) I…
JSP749
  • 127
  • 1
  • 3
  • 12
2
votes
1 answer

Why doesn't Reflections.getFieldsAnnotatedWith() return any fields?

I'm running into a problem with Reflections. I'm trying to get a Set of fields with Reflections#getFieldsAnnotatedWith method but when I run a unit test, it return nothing, can anybody tell me why? (I'm using the IntelliJ IDE) Here are the classes…
2
votes
1 answer

Java Scanning Class for Annotation using Google Reflections

I am trying to scan the Fields inside the class for my custom Annotation using google reflections. I don't know why but the result is always an empty set. Test Class public class AnnotationParser { public void parse() { String…
Raunak Agarwal
  • 7,117
  • 6
  • 38
  • 62
2
votes
1 answer

Problems implementing Annotation scanning using Reflections within RCP application

My first attempt at this was to simply include the Jars as part of my main application. (Eclipse 3.7) I know this is frowned upon, but I'm writing a standalone specialised app and I wasn't too worried about trying to fathom out bundles. Having…
Link19
  • 586
  • 1
  • 18
  • 47
2
votes
1 answer

Using Reflections for finding the (transitive) subtypes of a class when not all the types in the hierarchy are in the filtered classpath url

I am trying to use the Reflections library to obtain all the subclasses of a particular class. I need to filter the search to only the subclasses in a particular classpath url. This is the code I am using: ConfigurationBuilder config = new…
Sergio
  • 8,532
  • 11
  • 52
  • 94
1
vote
2 answers

How to validate field path in compile time in Scala 2?

Suppose I have a string with a field path of a Scala case class, e.g. case class A1(x: Int) case class A(a1: A1) val x = "a1.x" // field path of "x" in "A" I use this field path for runtime reflection. The problem is that these classes A and A1…
Michael
  • 41,026
  • 70
  • 193
  • 341
1
vote
1 answer

Can I change the value of a component from a separate button in Compose Multiplatform?

I am trying to make a desktop application that allows you to search through a number of predefined locations stored in Kotlin classes in a separate directory. To accomplish this, I've used the reflections and compose-jb libraries. The problem I've…
1
vote
1 answer

Java reflection java.lang.ClassNotFoundException. Related to finding the full class name

I am currently trying to develop a method for invoking a specific class. The problem I am having is that I need to get the fully-qualified name or full class name when I invoke the class. public static void testAlgorithm(String className, String…
1
vote
1 answer

Reflections throwing java.lang.IllegalStateException: zip file closed

I have this line in a Spring Boot application: final Reflections reflections = new Reflections("com.company", new SubTypesScanner(false)); and it works perfectly on my local development environment (Windows 10, version 21H1 and Java Version 8…
Hasan Can Saral
  • 2,950
  • 5
  • 43
  • 78
1
vote
0 answers

How to load an external implementation using the reflection library embedded in a jar

I have a library embedded in a jar which must load an external implementation : - MyFile - myjar.jar - Myfirstclass.java - MySecondclass.java Knowing that : My class dependent on my jar, my jar is executable and contains all the…
1
vote
1 answer

Search for java class using reflection with persistence unit

I want to search for a Java class using reflection with persistence unit. Now I'm using the search with the package name Reflections reflections = new Reflections("com.entites"); Set> allClasses =…
1
vote
1 answer

Java 8, Google Reflections -- Get Annotated Types as List of Annotations, not Class

StackOverflow-ers! I am building a game, namely Volts of Doom, in which users can write and place their own mods into a folder, which will then be loaded into the game (similarly to something like Minecraft Forge, except this game is designed to be…
Atom
  • 325
  • 1
  • 11