public class JavaCodeSerializer extends 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 TypesScanner
and TypeElementsScanner
the save(org.reflections.Reflections, String)
method filename should be in the pattern: path/path/path/package.package.classname
Modifier and Type | Class and Description |
---|---|
static interface |
JavaCodeSerializer.IClass |
static interface |
JavaCodeSerializer.IElement |
static interface |
JavaCodeSerializer.IField |
static interface |
JavaCodeSerializer.IMethod |
static interface |
JavaCodeSerializer.IPackage |
Constructor and Description |
---|
JavaCodeSerializer() |
Modifier and Type | Method and Description |
---|---|
Reflections |
read(InputStream inputStream)
reads the input stream into a new Reflections instance, populating it's store
|
static Class<?> |
resolveClass(Class<? extends JavaCodeSerializer.IClass> aClass) |
static Class<?> |
resolveClassOf(Class<? extends JavaCodeSerializer.IElement> element) |
static Field |
resolveField(Class<? extends JavaCodeSerializer.IField> aField) |
static Method |
resolveMethod(Class<? extends JavaCodeSerializer.IMethod> 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
|
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 Serializer
public String toString(Reflections reflections)
Serializer
toString
in interface Serializer
public static Class<?> resolveClassOf(Class<? extends JavaCodeSerializer.IElement> element) throws ClassNotFoundException
ClassNotFoundException
public static Class<?> resolveClass(Class<? extends JavaCodeSerializer.IClass> aClass)
public static Field resolveField(Class<? extends JavaCodeSerializer.IField> aField)
public static Method resolveMethod(Class<? extends JavaCodeSerializer.IMethod> aMethod)
Copyright © 2012. All Rights Reserved.