Class JavaCodeSerializer
java.lang.Object
org.reflections.serializers.JavaCodeSerializer
- All Implemented Interfaces:
Serializer
source code serialization for
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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAnnotations(List<String> typePaths, List<String> annotations) protected voidprotected voidprotected voidprotected voidaddPackages(List<String> typePaths, int i) private Stringindent(int times) protected voidindentClose(List<String> prevPaths) protected intindentOpen(List<String> typePaths, List<String> prevPaths) private Stringread(InputStream inputStream) reads the input stream into a new Reflections instance, populating it's storesave(Reflections reflections, String name) serialize and save to java source codeprivate voidtoString(Reflections reflections) private StringuniqueName(String candidate, List<String> prev) private StringuniqueName(String candidate, List<String> prev, int offset)
-
Field Details
-
pathSeparator
- See Also:
-
doubleSeparator
- See Also:
-
dotSeparator
- See Also:
-
arrayDescriptor
- See Also:
-
tokenSeparator
- See Also:
-
sb
-
prevPaths
-
indent
private int indent
-
-
Constructor Details
-
JavaCodeSerializer
public JavaCodeSerializer()
-
-
Method Details
-
read
Description copied from interface:Serializerreads the input stream into a new Reflections instance, populating it's store- Specified by:
readin interfaceSerializer
-
save
serialize and save to java source code- Specified by:
savein interfaceSerializer- Parameters:
name- should be in the patternpath/path/path/package.package.classname,
-
toString
-
indentOpen
-
indentClose
-
addPackages
-
addClass
-
addFields
-
addMethods
-
addAnnotations
-
uniqueName
-
normalize
-
uniqueName
-
indent
-