Skip to content
Browse files

processor

  • Loading branch information...
1 parent 319c43e commit 1166091133faeaa6f4c7b2e7452ceefccc4d27d1 @daolena-a committed Feb 13, 2012
View
6 pom.xml
@@ -12,6 +12,10 @@
<module>processor</module>
<module>testApp</module>
</modules>
-
+ <dependencies><dependency>
+ <groupId>com.google.code.javaparser</groupId>
+ <artifactId>javaparser</artifactId>
+ <version>1.0.1</version>
+ </dependency></dependencies>
</project>
View
4 processor/src/main/java/org/mapper/annotation/MappedBy.java
@@ -12,10 +12,10 @@
* Time: 09:08
* To change this template use File | Settings | File Templates.
*/
-@Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MappedBy {
- Class<?> targetedClass();
+ public Class<?> targetedClass();
}
View
21 processor/src/main/java/org/mapper/processor/MappedByProcessor.java
@@ -9,6 +9,8 @@
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
+import java.io.File;
+import java.lang.reflect.Field;
import java.util.Set;
@SupportedAnnotationTypes(
@@ -19,18 +21,27 @@
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
System.out.println("procesor test");
- for (TypeElement t : annotations){
+ MappedBy anno;
for(Element elem : roundEnv.getElementsAnnotatedWith(MappedBy.class)){
System.out.println( elem.asType().toString());
try {
+
Class clazz = Class.forName(elem.asType().toString());
+ System.out.println("name"+clazz.getCanonicalName());
+ anno =(MappedBy) clazz.getAnnotation(MappedBy.class);
+ if(anno == null) break;
+ File mappingFile = new File(clazz.getSimpleName()+"To"+anno.targetedClass()+".java");
+ mappingFile.createNewFile();
+ System.out.println("tse"+mappingFile.isFile());
+ for (Field f : clazz.getFields()){
+
+ }
System.out.println(clazz.getCanonicalName());
- } catch (ClassNotFoundException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ } catch (Exception e) {
+ e.printStackTrace();
}
- }
-
+
}
return true;
}

0 comments on commit 1166091

Please sign in to comment.
Something went wrong with that request. Please try again.