diff options
Diffstat (limited to 'eaaf_core_api/src')
-rw-r--r-- | eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java | 9 | ||||
-rw-r--r-- | eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/impl/data/Triple.java | 19 |
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); + + } } |