summaryrefslogtreecommitdiff
path: root/eaaf_core_api
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-02-05 15:31:30 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-02-05 15:31:30 +0100
commit963d6217f4bb1a1c91ca45b7020d80860038a610 (patch)
treec2785636a262796d54c2506fe6d8c8008675a6ab /eaaf_core_api
parent8ebf6c4b08a008a96b4ac60167c26b48c30e97ce (diff)
downloadEAAF-Components-963d6217f4bb1a1c91ca45b7020d80860038a610.tar.gz
EAAF-Components-963d6217f4bb1a1c91ca45b7020d80860038a610.tar.bz2
EAAF-Components-963d6217f4bb1a1c91ca45b7020d80860038a610.zip
update toString() implementations to generic version
Diffstat (limited to 'eaaf_core_api')
-rw-r--r--eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java9
-rw-r--r--eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Triple.java19
2 files changed, 27 insertions, 1 deletions
diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java
index 01116d75..aabd7f00 100644
--- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java
+++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java
@@ -20,12 +20,15 @@
package at.gv.egiz.eaaf.core.impl.data;
import java.io.Serializable;
+import java.text.MessageFormat;
public class Pair<P1, P2> implements Serializable {
private static final long serialVersionUID = 1022855782082259449L;
private final P1 first;
private final P2 second;
+ private static final String TO_STRING_PATTERN = "[{0}:{2} {1}:{3}]";
+
private Pair(final P1 newFirst, final P2 newSecond) {
this.first = newFirst;
this.second = newSecond;
@@ -45,7 +48,11 @@ public class Pair<P1, P2> implements Serializable {
@Override
public String toString() {
- return "[bPK-Value: " + getFirst() + " bPK-Type: " + getSecond() + "]";
+ return MessageFormat.format(TO_STRING_PATTERN,
+ this.first != null ? this.first.getClass().getSimpleName() : "null",
+ this.second != null ? this.second.getClass().getSimpleName() : "null",
+ this.first,
+ this.second);
}
}
diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Triple.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Triple.java
index 0ddb48aa..e4d2c4dd 100644
--- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Triple.java
+++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Triple.java
@@ -19,11 +19,18 @@
package at.gv.egiz.eaaf.core.impl.data;
+import java.text.MessageFormat;
+
public class Triple<P1, P2, P3> {
+
+ private static final String TO_STRING_PATTERN = "[{0}:{3} {1}:{4} {2}:{5}]";
+
private final P1 first;
private final P2 second;
private final P3 third;
+
+
private Triple(final P1 newFirst, final P2 newSecond, final P3 newThird) {
this.first = newFirst;
this.second = newSecond;
@@ -45,4 +52,16 @@ public class Triple<P1, P2, P3> {
public static <P1, P2, P3> Triple<P1, P2, P3> newInstance(final P1 newFirst, final P2 newSecond, final P3 newThird) {
return new Triple<>(newFirst, newSecond, newThird);
}
+
+ @Override
+ public String toString() {
+ return MessageFormat.format(TO_STRING_PATTERN,
+ this.first != null ? this.first.getClass().getSimpleName() : "null",
+ this.second != null ? this.second.getClass().getSimpleName() : "null",
+ this.third != null ? this.third.getClass().getSimpleName() : "null",
+ this.first,
+ this.second,
+ this.third);
+
+ }
}