public class JavaCodeSerializer extends java.lang.Object implements Serializer
serializes types and types elements into interfaces respectively to fully qualified name,
for example:
public interface MyTestModelStore { public interface org extends IPackage { public interface reflections extends IPackage { public interface TestModel$AC1 extends IClass {} public interface TestModel$C4 extends IClass { public interface f1 extends IField {} public interface m1 extends IMethod {} public interface m1_int_java$lang$String$$$$ extends IMethod {} ... }
use the different resolve methods to resolve the serialized element into Class, Field or Method. for example:
Class<? extends IMethod> imethod = MyTestModelStore.org.reflections.TestModel$C4.m1.class; Method method = JavaCodeSerializer.resolve(imethod);
depends on Reflections configured with TypeElementsScanner
the save(org.reflections.Reflections, String)
method filename should be in the pattern: path/path/path/package.package.classname
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
arrayDescriptor |
private static java.lang.String |
dotSeparator |
private static java.lang.String |
doubleSeparator |
private static java.lang.String |
pathSeparator |
private static java.lang.String |
tokenSeparator |
Constructor and Description |
---|
JavaCodeSerializer() |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
getNonDuplicateName(java.lang.String candidate,
java.util.List<java.lang.String> prev) |
private java.lang.String |
getNonDuplicateName(java.lang.String candidate,
java.util.List<java.lang.String> prev,
int offset) |
private java.lang.String |
normalize(java.lang.String candidate) |
Reflections |
read(java.io.InputStream inputStream)
reads the input stream into a new Reflections instance, populating it's store
|
static java.lang.annotation.Annotation |
resolveAnnotation(java.lang.Class annotation) |
static java.lang.Class<?> |
resolveClass(java.lang.Class aClass) |
static java.lang.Class<?> |
resolveClassOf(java.lang.Class element) |
static java.lang.reflect.Field |
resolveField(java.lang.Class aField) |
static java.lang.reflect.Method |
resolveMethod(java.lang.Class aMethod) |
java.io.File |
save(Reflections reflections,
java.lang.String name)
name should be in the pattern: path/path/path/package.package.classname,
for example
|
java.lang.String |
toString(Reflections reflections)
returns a string serialization of the given Reflections instance
|
private static final java.lang.String pathSeparator
private static final java.lang.String doubleSeparator
private static final java.lang.String dotSeparator
private static final java.lang.String arrayDescriptor
private static final java.lang.String tokenSeparator
public Reflections read(java.io.InputStream inputStream)
Serializer
read
in interface Serializer
public java.io.File save(Reflections reflections, java.lang.String name)
/data/projects/my/src/main/java/org.my.project.MyStorewould create class MyStore in package org.my.project in the path /data/projects/my/src/main/java
save
in interface Serializer
public java.lang.String toString(Reflections reflections)
Serializer
toString
in interface Serializer
private java.lang.String getNonDuplicateName(java.lang.String candidate, java.util.List<java.lang.String> prev, int offset)
private java.lang.String normalize(java.lang.String candidate)
private java.lang.String getNonDuplicateName(java.lang.String candidate, java.util.List<java.lang.String> prev)
public static java.lang.Class<?> resolveClassOf(java.lang.Class element) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public static java.lang.Class<?> resolveClass(java.lang.Class aClass)
public static java.lang.reflect.Field resolveField(java.lang.Class aField)
public static java.lang.annotation.Annotation resolveAnnotation(java.lang.Class annotation)
public static java.lang.reflect.Method resolveMethod(java.lang.Class aMethod)