Package org.reflections.serializers
Class JavaCodeSerializer
- java.lang.Object
-
- org.reflections.serializers.JavaCodeSerializer
-
- All Implemented Interfaces:
Serializer
public class JavaCodeSerializer extends Object implements Serializer
source code serialization forReflections
an example of produced java source:reflections.save(file, new JavaCodeSerializer())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.classdepends on
TypeElementsScannerconfigured
-
-
Constructor Summary
Constructors Constructor Description JavaCodeSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAnnotations(List<String> typePaths, List<String> annotations)protected voidaddClass(List<String> typePaths, String className)protected voidaddFields(List<String> typePaths, List<String> fields)protected voidaddMethods(List<String> typePaths, List<String> fields, List<String> methods)protected voidaddPackages(List<String> typePaths, int i)protected voidindentClose(List<String> prevPaths)protected intindentOpen(List<String> typePaths, List<String> prevPaths)Reflectionsread(InputStream inputStream)reads the input stream into a new Reflections instance, populating it's storeFilesave(Reflections reflections, String name)serialize and save to java source code
-
-
-
Method Detail
-
read
public Reflections read(InputStream inputStream)
Description copied from interface:Serializerreads the input stream into a new Reflections instance, populating it's store- Specified by:
readin interfaceSerializer
-
save
public File save(Reflections reflections, String name)
serialize and save to java source code- Specified by:
savein interfaceSerializer- Parameters:
name- should be in the patternpath/path/path/package.package.classname,
-
addMethods
protected void addMethods(List<String> typePaths, List<String> fields, List<String> methods)
-
-