From f37c32ea9e88aff5fd1f3983b0c36438cd95147b Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Sun, 27 Nov 2016 04:06:49 +0100 Subject: [PATCH] Correction des warning de Eclipse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pom.xml | 6 ++++++ .../java/fr/pandacube/java/util/db/sql_tools/ORM.java | 10 +++++----- .../fr/pandacube/java/util/db/sql_tools/SQLField.java | 4 ++-- .../fr/pandacube/java/util/db/sql_tools/SQLWhere.java | 4 ++-- .../java/util/db/sql_tools/SQLWhereChain.java | 6 +++--- .../pandacube/java/util/db/sql_tools/SQLWhereComp.java | 2 +- .../pandacube/java/util/db/sql_tools/SQLWhereLike.java | 2 +- .../pandacube/java/util/db/sql_tools/SQLWhereNull.java | 2 +- .../pandacube/java/util/network/client/TCPClient.java | 6 +++--- .../pandacube/java/util/network/server/TCPServer.java | 6 +++--- 10 files changed, 27 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index d8eb271..6cc291c 100644 --- a/pom.xml +++ b/pom.xml @@ -34,5 +34,11 @@ system ${project.basedir}/../libs/BungeePerms-3.0-alpha1-modif.jar + + org.javatuples + javatuples + 1.2 + compile + diff --git a/src/main/java/fr/pandacube/java/util/db/sql_tools/ORM.java b/src/main/java/fr/pandacube/java/util/db/sql_tools/ORM.java index 4f6b6ba..efd869a 100644 --- a/src/main/java/fr/pandacube/java/util/db/sql_tools/ORM.java +++ b/src/main/java/fr/pandacube/java/util/db/sql_tools/ORM.java @@ -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; /** * ORM = Object-Relational Mapping @@ -108,11 +108,11 @@ public final class ORM { boolean first = true; for (SQLField f : tableFields) { Pair> 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> 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; diff --git a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLField.java b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLField.java index 2388d2f..5860c5f 100644 --- a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLField.java +++ b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLField.java @@ -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, T> { @@ -58,7 +58,7 @@ public class SQLField, T> { */ @Override public String toString() { - return forSQLPreparedStatement().getKey().replaceFirst("\\?", + return forSQLPreparedStatement().getValue0().replaceFirst("\\?", (defaultValue != null && !autoIncrement) ? defaultValue.toString() : ""); } diff --git a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhere.java b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhere.java index 8d88419..cc8390f 100644 --- a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhere.java +++ b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhere.java @@ -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(); } } diff --git a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereChain.java b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereChain.java index 7ae68f5..eaf1317 100644 --- a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereChain.java +++ b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereChain.java @@ -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> ret = w.toSQL(); - sql += "(" + ret.getKey() + ")"; - params.addAll(ret.getValue()); + sql += "(" + ret.getValue0() + ")"; + params.addAll(ret.getValue1()); } return new Pair<>(sql, params); diff --git a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereComp.java b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereComp.java index a2f63a6..fcfb88b 100644 --- a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereComp.java +++ b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereComp.java @@ -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 { diff --git a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereLike.java b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereLike.java index f9a8092..3c13aae 100644 --- a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereLike.java +++ b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereLike.java @@ -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 { diff --git a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereNull.java b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereNull.java index 0e6ae6b..ac95feb 100644 --- a/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereNull.java +++ b/src/main/java/fr/pandacube/java/util/db/sql_tools/SQLWhereNull.java @@ -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 { diff --git a/src/main/java/fr/pandacube/java/util/network/client/TCPClient.java b/src/main/java/fr/pandacube/java/util/network/client/TCPClient.java index 6331bfc..02c815a 100644 --- a/src/main/java/fr/pandacube/java/util/network/client/TCPClient.java +++ b/src/main/java/fr/pandacube/java/util/network/client/TCPClient.java @@ -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, ResponseCallback>> it = callbacks.iterator(); it.hasNext();) { Pair, ResponseCallback> 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) { diff --git a/src/main/java/fr/pandacube/java/util/network/server/TCPServer.java b/src/main/java/fr/pandacube/java/util/network/server/TCPServer.java index a6f042e..3ad8bb8 100644 --- a/src/main/java/fr/pandacube/java/util/network/server/TCPServer.java +++ b/src/main/java/fr/pandacube/java/util/network/server/TCPServer.java @@ -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, ResponseCallback>> it = callbacks.iterator(); it.hasNext();) { Pair, ResponseCallback> 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) {