aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-08-16 18:49:05 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-08-16 18:49:05 +0200
commit804d3141d8dee14082a9a10b75ad191e386c5576 (patch)
tree63964bd2f194fb7734c9de4e436720e044631aaf /sonar-core
parentffded94d51008c00351a231cc9b6b86201400dec (diff)
downloadsonarqube-804d3141d8dee14082a9a10b75ad191e386c5576.tar.gz
sonarqube-804d3141d8dee14082a9a10b75ad191e386c5576.zip
SONAR-2655 define toString() on all the hibernate models
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/api/database/configuration/Property.java9
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/NotificationQueueElement.java6
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java13
4 files changed, 26 insertions, 10 deletions
diff --git a/sonar-core/src/main/java/org/sonar/api/database/configuration/Property.java b/sonar-core/src/main/java/org/sonar/api/database/configuration/Property.java
index f464c73adb6..9e95166c7f2 100644
--- a/sonar-core/src/main/java/org/sonar/api/database/configuration/Property.java
+++ b/sonar-core/src/main/java/org/sonar/api/database/configuration/Property.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.database.configuration;
-import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.database.BaseIdentifiable;
@@ -139,11 +139,6 @@ public class Property extends BaseIdentifiable {
@Override
public String toString() {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("key", key)
- .append("resource", resourceId)
- .append("user", userId)
- .append("value", value)
- .toString();
+ return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
}
}
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java b/sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java
index 94feb1299db..cdb2a575aff 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java
@@ -19,6 +19,9 @@
*/
package org.sonar.jpa.entity;
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
import javax.persistence.*;
import java.util.Date;
@@ -91,4 +94,9 @@ public final class ManualMeasure {
public String getUserLogin() {
return userLogin;
}
+
+ @Override
+ public String toString() {
+ return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
+ }
}
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/NotificationQueueElement.java b/sonar-core/src/main/java/org/sonar/jpa/entity/NotificationQueueElement.java
index 8428ab9a20e..b1221100509 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/entity/NotificationQueueElement.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/entity/NotificationQueueElement.java
@@ -20,6 +20,8 @@
package org.sonar.jpa.entity;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.notifications.Notification;
import org.sonar.api.utils.SonarException;
@@ -98,4 +100,8 @@ public class NotificationQueueElement {
}
}
+ @Override
+ public String toString() {
+ return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
+ }
}
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
index e0ab95f1abd..ea17a6e5195 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
@@ -19,15 +19,17 @@
*/
package org.sonar.jpa.entity;
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
+import javax.persistence.*;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import javax.persistence.*;
-
@Entity
-@Table(name = SchemaMigration.TABLE_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "version" }) })
+@Table(name = SchemaMigration.TABLE_NAME, uniqueConstraints = {@UniqueConstraint(columnNames = {"version"})})
public class SchemaMigration {
public final static int VERSION_UNKNOWN = -1;
@@ -102,4 +104,9 @@ public class SchemaMigration {
}
}
}
+
+ @Override
+ public String toString() {
+ return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
+ }
}