get seabottle function and operation
This commit is contained in:
parent
26ff3c3fab
commit
72c4a3cc6a
4 changed files with 42 additions and 3 deletions
Binary file not shown.
|
@ -1,5 +1,12 @@
|
|||
package dev.peerat.mapping;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface SeaBottle {
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class TreasureCache<T> {
|
|||
|
||||
//SELECT id from players where name = 'test'
|
||||
|
||||
public static void Keep(Object... fields){
|
||||
public static void keep(Object... fields){
|
||||
breaker();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.io.BufferedWriter;
|
|||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
@ -24,9 +23,11 @@ import be.jeffcheasey88.peeratcode.parser.Parser;
|
|||
import be.jeffcheasey88.peeratcode.parser.TokenValidator;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.Annotation;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.Class;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.Function;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaFile;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaParser;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.operation.ReturnOperation;
|
||||
|
||||
public class TreasureProcessor extends AbstractProcessor{
|
||||
|
||||
|
@ -105,10 +106,41 @@ public class TreasureProcessor extends AbstractProcessor{
|
|||
return false;
|
||||
});
|
||||
if(treasure != null){
|
||||
|
||||
processTreasure(file, treasure);
|
||||
}else{
|
||||
processOthers(file);
|
||||
}
|
||||
}
|
||||
|
||||
private void processTreasure(JavaFile file, Class clazz){
|
||||
for(JavaElement child : clazz.getElements()){
|
||||
if(child instanceof Function){
|
||||
Function function = (Function)child;
|
||||
if(function.find((subelement) -> {
|
||||
if(subelement instanceof Annotation){
|
||||
Annotation annotation = (Annotation)subelement;
|
||||
if(annotation.getName().getValue().equals("SeaBottle")) return true; //can also be dev.peerat.mapping.SeaBottle
|
||||
}
|
||||
return false;
|
||||
}) != null){
|
||||
processSeaBottle(function);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processSeaBottle(Function function){
|
||||
if(function.getElements().size() != 1) return;
|
||||
JavaElement target = function.getElements().get(0);
|
||||
if(!(target instanceof ReturnOperation)) return;
|
||||
ReturnOperation operation = (ReturnOperation)target;
|
||||
|
||||
}
|
||||
|
||||
private void processOthers(JavaFile file){
|
||||
|
||||
}
|
||||
|
||||
private void error(File source, File output, File clazz, Exception e) throws Exception{
|
||||
File out = new File(output, "log.txt");
|
||||
File parent = out.getParentFile();
|
||||
|
|
Loading…
Add table
Reference in a new issue