library that allows you to read class bytes and see all of the class metadata without loading the class which might cause a large amount of class loading from imports. There are a number of times you might want to do this if you wanted to interrogate a class to make sure that it has certain annotations or qualities before incurring the cost of loading it with the ClassLoader.
This is based on the Java class format documentation.
Enjoy. Gray Watson
Read in a class from a file.
String path = "target/classes/path/to/classfile.class";
CsvProcessor<Account> csvProcessor = new CsvProcessor<Account>(Account.class);
try (InputStream fis = new FileInputStream(path);) {
ClassInfo info = ClassReader.readClass(fis);
System.out.println("Class name is " + info.getName());
System.out.println("Fields: " + Arrays.toString(info.getFields());
System.out.println("Constructors: " + Arrays.toString(info.getConstructors());
System.out.println("Methods: " + Arrays.toString(info.getMethods());
}
Maven packages are published via Maven Central
<dependency>
<groupId>com.j256.simpleclassreader</groupId>
<artifactId>simpleclassreader</artifactId>
<version>0.4</version>
</dependency>See the ChangeLog.txt file.