Correction des warning de Eclipse

La classe javafx.util.Pair n'aurait pas dû être utilisé dans le projet
(Utilisation réservée en interne à l'API JavaFX).
Utilisation de org.javatuples:javatuples comme librairie pour la classe Pair.
This commit is contained in:
Marc Baloup 2016-11-27 04:06:49 +01:00
parent 13655c1efa
commit f37c32ea9e
10 changed files with 27 additions and 21 deletions

View File

@ -34,5 +34,11 @@
<scope>system</scope>
<systemPath>${project.basedir}/../libs/BungeePerms-3.0-alpha1-modif.jar</systemPath>
</dependency>
<dependency>
<groupId>org.javatuples</groupId>
<artifactId>javatuples</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -31,7 +31,7 @@ import fr.pandacube.java.util.db.SQLStaticPages;
import fr.pandacube.java.util.db.SQLUUIDPlayer;
import fr.pandacube.java.util.db.sql_tools.SQLWhereChain.SQLBoolOp;
import fr.pandacube.java.util.db.sql_tools.SQLWhereComp.SQLComparator;
import javafx.util.Pair;
import org.javatuples.Pair;
/**
* <b>ORM = Object-Relational Mapping</b>
@ -108,11 +108,11 @@ public final class ORM {
boolean first = true;
for (SQLField<E, ?> f : tableFields) {
Pair<String, List<Object>> statementPart = f.forSQLPreparedStatement();
params.addAll(statementPart.getValue());
params.addAll(statementPart.getValue1());
if (!first) sql += ", ";
first = false;
sql += statementPart.getKey();
sql += statementPart.getValue0();
}
sql += ", PRIMARY KEY id(id))";
@ -185,8 +185,8 @@ public final class ORM {
if (where != null) {
Pair<String, List<Object>> ret = where.toSQL();
sql += " WHERE " + ret.getKey();
params.addAll(ret.getValue());
sql += " WHERE " + ret.getValue0();
params.addAll(ret.getValue1());
}
if (orderBy != null) sql += " ORDER BY " + orderBy.toSQL();
if (limit != null) sql += " LIMIT " + limit;

View File

@ -3,7 +3,7 @@ package fr.pandacube.java.util.db.sql_tools;
import java.util.ArrayList;
import java.util.List;
import javafx.util.Pair;
import org.javatuples.Pair;
public class SQLField<E extends SQLElement<E>, T> {
@ -58,7 +58,7 @@ public class SQLField<E extends SQLElement<E>, T> {
*/
@Override
public String toString() {
return forSQLPreparedStatement().getKey().replaceFirst("\\?",
return forSQLPreparedStatement().getValue0().replaceFirst("\\?",
(defaultValue != null && !autoIncrement) ? defaultValue.toString() : "");
}

View File

@ -2,7 +2,7 @@ package fr.pandacube.java.util.db.sql_tools;
import java.util.List;
import javafx.util.Pair;
import org.javatuples.Pair;
public abstract class SQLWhere {
@ -10,7 +10,7 @@ public abstract class SQLWhere {
@Override
public String toString() {
return toSQL().getKey();
return toSQL().getValue0();
}
}

View File

@ -3,7 +3,7 @@ package fr.pandacube.java.util.db.sql_tools;
import java.util.ArrayList;
import java.util.List;
import javafx.util.Pair;
import org.javatuples.Pair;
public class SQLWhereChain extends SQLWhere {
@ -32,8 +32,8 @@ public class SQLWhereChain extends SQLWhere {
first = false;
Pair<String, List<Object>> ret = w.toSQL();
sql += "(" + ret.getKey() + ")";
params.addAll(ret.getValue());
sql += "(" + ret.getValue0() + ")";
params.addAll(ret.getValue1());
}
return new Pair<>(sql, params);

View File

@ -3,7 +3,7 @@ package fr.pandacube.java.util.db.sql_tools;
import java.util.ArrayList;
import java.util.List;
import javafx.util.Pair;
import org.javatuples.Pair;
public class SQLWhereComp extends SQLWhere {

View File

@ -3,7 +3,7 @@ package fr.pandacube.java.util.db.sql_tools;
import java.util.ArrayList;
import java.util.List;
import javafx.util.Pair;
import org.javatuples.Pair;
public class SQLWhereLike extends SQLWhere {

View File

@ -5,7 +5,7 @@ import java.util.List;
import java.util.logging.Level;
import fr.pandacube.java.util.Log;
import javafx.util.Pair;
import org.javatuples.Pair;
public class SQLWhereNull extends SQLWhere {

View File

@ -26,7 +26,7 @@ import fr.pandacube.java.util.network.packet.PacketException;
import fr.pandacube.java.util.network.packet.PacketServer;
import fr.pandacube.java.util.network.packet.ResponseCallback;
import fr.pandacube.java.util.network.packet.packets.global.PacketServerException;
import javafx.util.Pair;
import org.javatuples.Pair;
public class TCPClient extends Thread implements Closeable {
@ -123,9 +123,9 @@ public class TCPClient extends Thread implements Closeable {
for(Iterator<Pair<Predicate<PacketServer>, ResponseCallback<PacketServer>>> it = callbacks.iterator(); it.hasNext();) {
Pair<Predicate<PacketServer>, ResponseCallback<PacketServer>> c = it.next();
try {
if (c.getKey().test(ps)) {
if (c.getValue0().test(ps)) {
it.remove();
c.getValue().call(ps);
c.getValue1().call(ps);
executedOne = true;
}
} catch (Exception e) {

View File

@ -33,7 +33,7 @@ import fr.pandacube.java.util.network.packet.PacketServer;
import fr.pandacube.java.util.network.packet.ResponseCallback;
import fr.pandacube.java.util.network.packet.bytebuffer.ByteBuffer;
import fr.pandacube.java.util.network.packet.packets.global.PacketServerException;
import javafx.util.Pair;
import org.javatuples.Pair;
/**
*
@ -179,9 +179,9 @@ public class TCPServer extends Thread implements Closeable {
for(Iterator<Pair<Predicate<PacketClient>, ResponseCallback<PacketClient>>> it = callbacks.iterator(); it.hasNext();) {
Pair<Predicate<PacketClient>, ResponseCallback<PacketClient>> c = it.next();
try {
if (c.getKey().test(pc)) {
if (c.getValue0().test(pc)) {
it.remove();
c.getValue().call(pc);
c.getValue1().call(pc);
executedOne = true;
}
} catch (Exception e) {