|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.reflections.serializers.JavaCodeSerializer
public class JavaCodeSerializer
serialization of Reflections to java code
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
| Constructor Summary | |
|---|---|
JavaCodeSerializer()
|
|
| Method Summary | |
|---|---|
Reflections |
read(InputStream inputStream)
reads the input stream into a new Reflections instance, populating it's store |
static Annotation |
resolveAnnotation(Class annotation)
|
static Class<?> |
resolveClass(Class aClass)
|
static Class<?> |
resolveClassOf(Class element)
|
static Field |
resolveField(Class aField)
|
static Method |
resolveMethod(Class aMethod)
|
File |
save(Reflections reflections,
String name)
name should be in the pattern: path/path/path/package.package.classname, for example |
String |
toString(Reflections reflections)
returns a string serialization of the given Reflections instance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JavaCodeSerializer()
| Method Detail |
|---|
public Reflections read(InputStream inputStream)
Serializer
read in interface Serializer
public File save(Reflections reflections,
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 Serializerpublic String toString(Reflections reflections)
Serializer
toString in interface Serializer
public static Class<?> resolveClassOf(Class element)
throws ClassNotFoundException
ClassNotFoundExceptionpublic static Class<?> resolveClass(Class aClass)
public static Field resolveField(Class aField)
public static Annotation resolveAnnotation(Class annotation)
public static Method resolveMethod(Class aMethod)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||