|
1 | 1 | package com.readdle.codegen; |
2 | 2 |
|
| 3 | +import com.readdle.codegen.anotation.SwiftGetter; |
| 4 | +import com.readdle.codegen.anotation.SwiftSetter; |
3 | 5 | import com.readdle.codegen.anotation.SwiftValue; |
4 | 6 |
|
5 | 7 | import java.io.File; |
@@ -30,7 +32,7 @@ class SwiftValueDescriptor { |
30 | 32 | private String simpleTypeName; |
31 | 33 | private String[] importPackages; |
32 | 34 |
|
33 | | - List<SwiftFuncDescriptor> functions = new LinkedList<>(); |
| 35 | + List<JavaSwiftProcessor.WritableElement> functions = new LinkedList<>(); |
34 | 36 |
|
35 | 37 | SwiftValueDescriptor(TypeElement classElement, Filer filer, String[] importPackages) throws IllegalArgumentException { |
36 | 38 | this.annotatedClassElement = classElement; |
@@ -93,7 +95,15 @@ class SwiftValueDescriptor { |
93 | 95 | if (element.getKind() == ElementKind.METHOD) { |
94 | 96 | ExecutableElement executableElement = (ExecutableElement) element; |
95 | 97 | if (executableElement.getModifiers().contains(Modifier.NATIVE)) { |
96 | | - functions.add(new SwiftFuncDescriptor(executableElement)); |
| 98 | + if (executableElement.getAnnotation(SwiftGetter.class) != null) { |
| 99 | + functions.add(new SwiftGetterDescriptor(executableElement)); |
| 100 | + } |
| 101 | + else if (executableElement.getAnnotation(SwiftSetter.class) != null) { |
| 102 | + functions.add(new SwiftSetterDescriptor(executableElement)); |
| 103 | + } |
| 104 | + else { |
| 105 | + functions.add(new SwiftFuncDescriptor(executableElement)); |
| 106 | + } |
97 | 107 | } |
98 | 108 | } |
99 | 109 | } |
@@ -124,7 +134,7 @@ File generateCode() throws IOException { |
124 | 134 |
|
125 | 135 | swiftWriter.endExtension(); |
126 | 136 |
|
127 | | - for (SwiftFuncDescriptor function : functions) { |
| 137 | + for (JavaSwiftProcessor.WritableElement function : functions) { |
128 | 138 | function.generateCode(swiftWriter, javaFullName, simpleTypeName); |
129 | 139 | } |
130 | 140 |
|
|
0 commit comments