Base getting sea bottles
This commit is contained in:
parent
fbdfd71f00
commit
d7b367fcad
4 changed files with 49 additions and 3 deletions
Binary file not shown.
|
@ -33,7 +33,6 @@ import dev.peerat.parser.java.Function;
|
|||
import dev.peerat.parser.java.JavaElement;
|
||||
import dev.peerat.parser.java.JavaFile;
|
||||
import dev.peerat.parser.java.JavaParser;
|
||||
import dev.peerat.parser.java.Value;
|
||||
import dev.peerat.parser.java.Value.InstanceValue;
|
||||
import dev.peerat.parser.java.operation.ReturnOperation;
|
||||
|
||||
|
@ -105,7 +104,7 @@ public class TreasureProcessor extends AbstractProcessor{
|
|||
});
|
||||
if(treasure != null){
|
||||
provider.mapTreasure(treasure);
|
||||
annotations.forEach((a) -> roundEnv.getElementsAnnotatedWith(a).forEach((e) -> processingEnv.getMessager().printMessage(Kind.ERROR, classes.getKey().getName(), e)));
|
||||
// annotations.forEach((a) -> roundEnv.getElementsAnnotatedWith(a).forEach((e) -> processingEnv.getMessager().printMessage(Kind.ERROR, classes.getKey().getName(), e)));
|
||||
List<Function> seaBottles = new ArrayList<>();
|
||||
treasure.findAll((element) -> {
|
||||
if(element instanceof Function){
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package dev.peerat.mapping.providers.mysql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import dev.peerat.parser.java.Value.MethodCallValue;
|
||||
|
||||
public class MySQLRequestBuilder{
|
||||
|
||||
private List<MethodCallValue> calls;
|
||||
private String select;
|
||||
private String from;
|
||||
|
||||
public MySQLRequestBuilder(List<MethodCallValue> calls){
|
||||
this.calls = calls;
|
||||
}
|
||||
|
||||
private String toStringOperation(MethodCallValue value){
|
||||
String method = value.getToken().getValue();
|
||||
if(method.equals("selectAll()")){
|
||||
return "SELECT *";
|
||||
}
|
||||
if(method.equals("select()")){
|
||||
throw new RuntimeException(value.getParameters().get(0)+"");
|
||||
// return "SELECT ";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void build(){
|
||||
this.select = toStringOperation(calls.get(0));
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package dev.peerat.mapping.providers.mysql;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import dev.peerat.mapping.providers.Provider;
|
||||
|
@ -9,6 +10,7 @@ import dev.peerat.mapping.providers.ProviderManager;
|
|||
import dev.peerat.parser.java.Class;
|
||||
import dev.peerat.parser.java.Function;
|
||||
import dev.peerat.parser.java.Value;
|
||||
import dev.peerat.parser.java.Value.MethodCallValue;
|
||||
import dev.peerat.parser.java.operation.ReturnOperation;
|
||||
|
||||
public class MySQLProvider implements Provider{
|
||||
|
@ -38,7 +40,18 @@ public class MySQLProvider implements Provider{
|
|||
public void mapBottle(Class clazz, Function function){
|
||||
ReturnOperation operation = (ReturnOperation) function.getElements().get(0);
|
||||
Value value = operation.getValue();
|
||||
throw new IllegalArgumentException(value.toString());
|
||||
if(value instanceof MethodCallValue){
|
||||
MethodCallValue call = (MethodCallValue)value;
|
||||
throw new RuntimeException(clazz.getName().getValue()+" - "+call);
|
||||
/*List<MethodCallValue> list = new LinkedList<>();
|
||||
while(call.base() instanceof MethodCallValue){
|
||||
list.add(0, call);
|
||||
call = (MethodCallValue) call.base();
|
||||
}
|
||||
list.add(0, call);
|
||||
MySQLRequestBuilder builder = new MySQLRequestBuilder(list);
|
||||
builder.build();*/
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue