public class JavaCodeSerializer extends Object implements Serializer
Reflections reflections.save(file, new JavaCodeSerializer())
an example of produced java source:
public interface MyTestModelStore {
interface org {
interface reflections {
interface TestModel$C4 {
interface fields {
interface f1 {}
interface f2 {}
}
interface methods {
interface m1 {}
interface add {}
}
interface annotations {
...
}
}
}
}
}
this allows strongly typed access by fqn to type elements - packages, classes, annotations, fields and methods:
MyTestModelStore.org.reflections.TestModel$C1.methods.m1.class
depends on TypeElementsScanner configured
| Constructor and Description |
|---|
JavaCodeSerializer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAnnotations(List<String> typePaths,
List<String> annotations) |
protected void |
addClass(List<String> typePaths,
String className) |
protected void |
addFields(List<String> typePaths,
List<String> fields) |
protected void |
addMethods(List<String> typePaths,
List<String> fields,
List<String> methods) |
protected void |
addPackages(List<String> typePaths,
int i) |
protected void |
indentClose(List<String> prevPaths) |
protected int |
indentOpen(List<String> typePaths,
List<String> prevPaths) |
Reflections |
read(InputStream inputStream)
reads the input stream into a new Reflections instance, populating it's store
|
File |
save(Reflections reflections,
String name)
serialize and save to java source code
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprepareFilepublic Reflections read(InputStream inputStream)
Serializerread in interface Serializerpublic File save(Reflections reflections, String name)
save in interface Serializername - should be in the pattern path/path/path/package.package.classname,protected void addMethods(List<String> typePaths, List<String> fields, List<String> methods)
Copyright © 2023. All rights reserved.