aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-04-03 23:22:13 +0200
committerSven Gothel <[email protected]>2015-04-03 23:22:13 +0200
commit367de26fdba6baa12265dd614110ac618063dce4 (patch)
tree17440a30a2265d2bfe608eeb0933814297eb7daa
parent45e18a543f7f11bf5e701f898e7c1221bd2f2672 (diff)
FieldInfo, MethodInfo: Add toString()
-rw-r--r--api/src/main/java/org/osjava/jardiff/FieldInfo.java11
-rw-r--r--api/src/main/java/org/osjava/jardiff/MethodInfo.java10
2 files changed, 17 insertions, 4 deletions
diff --git a/api/src/main/java/org/osjava/jardiff/FieldInfo.java b/api/src/main/java/org/osjava/jardiff/FieldInfo.java
index ef86ea7..c159ba9 100644
--- a/api/src/main/java/org/osjava/jardiff/FieldInfo.java
+++ b/api/src/main/java/org/osjava/jardiff/FieldInfo.java
@@ -16,6 +16,8 @@
*/
package org.osjava.jardiff;
+import java.util.Arrays;
+
/**
* Information about a field of a class.
*
@@ -47,8 +49,8 @@ public final class FieldInfo extends AbstractInfo
* @param signature The signature of this field.
* @param value The initial value of the field.
*/
- public FieldInfo(int access, String name, String desc, String signature,
- Object value) {
+ public FieldInfo(final int access, final String name, final String desc, final String signature,
+ final Object value) {
super(access, name);
this.desc = desc;
this.signature = signature;
@@ -73,4 +75,9 @@ public final class FieldInfo extends AbstractInfo
public final Object getValue() {
return value;
}
+
+ public String toString() {
+ final String t = null != value ? value.getClass().getName() : null;
+ return "desc["+desc+"], sig["+signature+"], value[type "+t+", data "+value;
+ }
}
diff --git a/api/src/main/java/org/osjava/jardiff/MethodInfo.java b/api/src/main/java/org/osjava/jardiff/MethodInfo.java
index 0a59c60..797faa4 100644
--- a/api/src/main/java/org/osjava/jardiff/MethodInfo.java
+++ b/api/src/main/java/org/osjava/jardiff/MethodInfo.java
@@ -16,6 +16,8 @@
*/
package org.osjava.jardiff;
+import java.util.Arrays;
+
/**
* A class to hold information about a method.
*
@@ -46,8 +48,8 @@ public final class MethodInfo extends AbstractInfo
* @param signature The signature of the method.
* @param exceptions The exceptions thrown by the method.
*/
- public MethodInfo(int access, String name, String desc, String signature,
- String[] exceptions) {
+ public MethodInfo(final int access, final String name, final String desc, final String signature,
+ final String[] exceptions) {
super(access, name);
this.desc = desc;
this.signature = signature;
@@ -72,4 +74,8 @@ public final class MethodInfo extends AbstractInfo
public final String[] getExceptions() {
return exceptions;
}
+
+ public String toString() {
+ return "desc["+desc+"], sig["+signature+"], throws "+(null != exceptions ? Arrays.asList(exceptions) : "nil");
+ }
}