Compare commits
No commits in common. "7c6b2a0e2329734b8768e1ed979b5b5692ddb33c" and "b17ce88e11ea81470c6fcea3d5c9522dcb8e9516" have entirely different histories.
7c6b2a0e23
...
b17ce88e11
9 changed files with 14 additions and 150 deletions
Binary file not shown.
|
@ -1,12 +1,5 @@
|
|||
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 {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package dev.peerat.mapping;
|
||||
|
||||
import dev.peerat.mapping.providers.Compass;
|
||||
import dev.peerat.mapping.providers.Map;
|
||||
|
||||
public class Ship{
|
||||
|
||||
private String type;
|
||||
private Compass compass;
|
||||
private Map map;
|
||||
|
||||
public Ship(String type, Compass compass,Map map){
|
||||
this.type = type;
|
||||
this.compass = compass;
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public void setSails() throws Exception{}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -53,12 +53,7 @@ public class TreasureCache<T> {
|
|||
return null;
|
||||
}
|
||||
|
||||
public <J> TreasureCache<J> join(){
|
||||
breaker();
|
||||
return null;
|
||||
}
|
||||
|
||||
public <B> TreasureCache<B> rebase(){
|
||||
public TreasureCache<T> join(){
|
||||
breaker();
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -19,16 +19,13 @@ import javax.tools.Diagnostic.Kind;
|
|||
import javax.tools.FileObject;
|
||||
import javax.tools.StandardLocation;
|
||||
|
||||
import dev.peerat.parser.ElementBuilder.Builder;
|
||||
import dev.peerat.parser.Parser;
|
||||
import dev.peerat.parser.TokenValidator;
|
||||
import dev.peerat.parser.java.Annotation;
|
||||
import dev.peerat.parser.java.Class;
|
||||
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.operation.ReturnOperation;
|
||||
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.JavaElement;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaFile;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaParser;
|
||||
|
||||
public class TreasureProcessor extends AbstractProcessor{
|
||||
|
||||
|
@ -79,7 +76,8 @@ public class TreasureProcessor extends AbstractProcessor{
|
|||
PARSER.parse(reader, javaFile);
|
||||
process(source, output, file, javaFile);
|
||||
}catch(Exception ex){
|
||||
error(source, output, file, new Exception(file.getName()+" | "+ex.getMessage()));
|
||||
error(source, output, file, ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,10 +86,9 @@ public class TreasureProcessor extends AbstractProcessor{
|
|||
File parent = out.getParentFile();
|
||||
if(!parent.exists()) parent.mkdirs();
|
||||
if(!out.exists()) out.createNewFile();
|
||||
if(TokenValidator.TOKENS != TokenValidator.MAX_VALIDATE) throw new Exception(TokenValidator.TOKENS +" < "+TokenValidator.MAX_VALIDATE);
|
||||
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(out));
|
||||
// BufferedWriter writer = new BufferedWriter(new FileWriter(out));
|
||||
// PARSER.build(writer);
|
||||
if(TokenValidator.TOKENS != TokenValidator.MAX_VALIDATE) throw new Exception(TokenValidator.TOKENS +" < "+TokenValidator.MAX_VALIDATE);
|
||||
|
||||
Class treasure = file.find((element) -> {
|
||||
if(element instanceof Class){
|
||||
|
@ -107,45 +104,10 @@ public class TreasureProcessor extends AbstractProcessor{
|
|||
return false;
|
||||
});
|
||||
if(treasure != null){
|
||||
processTreasure(file, treasure);
|
||||
}else{
|
||||
processOthers(file);
|
||||
}
|
||||
Builder builder = new Builder();
|
||||
file.build(builder);
|
||||
builder.build(writer);
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
package dev.peerat.mapping.providers;
|
||||
|
||||
public interface Compass{}
|
|
@ -1,3 +0,0 @@
|
|||
package dev.peerat.mapping.providers;
|
||||
|
||||
public interface Map{}
|
|
@ -1,40 +0,0 @@
|
|||
package dev.peerat.mapping.providers.mysql;
|
||||
|
||||
import dev.peerat.mapping.providers.Compass;
|
||||
|
||||
public class MySQLCompass implements Compass{
|
||||
|
||||
private String host;
|
||||
private int port;
|
||||
private String database;
|
||||
private String user;
|
||||
private String password;
|
||||
|
||||
public MySQLCompass(String host, int port, String database, String user, String password){
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.database = database;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getHost(){
|
||||
return this.host;
|
||||
}
|
||||
|
||||
public int getPort(){
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public String getDatabase(){
|
||||
return this.database;
|
||||
}
|
||||
|
||||
public String getUser(){
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public String getPassword(){
|
||||
return this.password;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package dev.peerat.mapping.providers.mysql;
|
||||
|
||||
import dev.peerat.mapping.providers.Map;
|
||||
|
||||
public class MySqlMap implements Map{
|
||||
|
||||
public MySqlMap(){}
|
||||
|
||||
public MySqlMap link(Class<?> clazz, String table){
|
||||
return this;
|
||||
}
|
||||
|
||||
public MySqlMap ref(String table_from, String column_from, String table_to, String column_to){
|
||||
return this;
|
||||
}
|
||||
|
||||
public MySqlMap bind(Class<?> clazz, String jfield, String sfield){
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue