-4

Is there any way to generate a list of all classes and methods in my Java codebase?

EvenLisle
  • 4,672
  • 3
  • 24
  • 47
Reginald
  • 798
  • 1
  • 6
  • 16

1 Answers1

1

My interpretation of your question is that you want to get all classes and methods in the "codebase" (interpreting as package). This is not possible, as class loaders only serve requests for classes by returning the requested class, or by throwing an exception. Class loaders make no commitment to tell the VM what classes it may provide.

EDIT

A lot can be achieved with the reflections library:

 Reflections reflections = new Reflections("com.example.project", new SubTypesScanner(false));

 Set<Class<? extends Object>> classes = 
     reflections.getSubTypesOf(Object.class);
EvenLisle
  • 4,672
  • 3
  • 24
  • 47