summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/data/util/AbstractProperty.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-04-22 15:06:09 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-24 09:41:22 +0000
commitbe433ace81027bfe9225513badbf4a07d3816377 (patch)
tree0cac26e36226ab27901a58276a4ebadd9eae3ccd /server/src/com/vaadin/data/util/AbstractProperty.java
parent9fe007a843805e8f8d8926848ce07bdab0bcd1d7 (diff)
downloadvaadin-framework-be433ace81027bfe9225513badbf4a07d3816377.tar.gz
vaadin-framework-be433ace81027bfe9225513badbf4a07d3816377.zip
Re-added Property.toString warning messages (#10916)
* Made it possible to toggle the toString() behavior using the "legacyPropertyToString" init parameter. The default value is "warning" which enables the legacy Property.toString implementation and logs a warning message when it is used. Other supported values are "true" which enables the legacy mode and "false" which disables it. Change-Id: Ife19352b86590464c8e441b7f82f4fec3b1f3235
Diffstat (limited to 'server/src/com/vaadin/data/util/AbstractProperty.java')
-rw-r--r--server/src/com/vaadin/data/util/AbstractProperty.java37
1 files changed, 21 insertions, 16 deletions
diff --git a/server/src/com/vaadin/data/util/AbstractProperty.java b/server/src/com/vaadin/data/util/AbstractProperty.java
index 499421a8b4..903f2f50f2 100644
--- a/server/src/com/vaadin/data/util/AbstractProperty.java
+++ b/server/src/com/vaadin/data/util/AbstractProperty.java
@@ -18,7 +18,6 @@ package com.vaadin.data.util;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
-import java.util.logging.Level;
import java.util.logging.Logger;
import com.vaadin.data.Property;
@@ -71,27 +70,33 @@ public abstract class AbstractProperty<T> implements Property<T>,
}
/**
- * Returns the value of the <code>Property</code> in human readable textual
- * format.
+ * Returns a string representation of this object. The returned string
+ * representation depends on if the legacy Property toString mode is enabled
+ * or disabled.
+ * <p>
+ * If legacy Property toString mode is enabled, returns the value of the
+ * <code>Property</code> converted to a String.
+ * </p>
+ * <p>
+ * If legacy Property toString mode is disabled, the string representation
+ * has no special meaning
+ * </p>
*
- * @return String representation of the value stored in the Property
- * @deprecated As of 7.0, use {@link #getValue()} instead and possibly
- * toString on that
+ * @see LegacyPropertyHelper#isLegacyToStringEnabled()
+ *
+ * @return A string representation of the value value stored in the Property
+ * or a string representation of the Property object.
+ * @deprecated As of 7.0. To get the property value, use {@link #getValue()}
+ * instead (and possibly toString on that)
*/
@Deprecated
@Override
public String toString() {
- getLogger()
- .log(Level.WARNING,
- "You are using Property.toString() instead of getValue() to get the value for a {0}."
- + "This will not be supported starting from Vaadin 7.1 "
- + "(your debugger might call toString() and cause this message to appear).",
- getClass().getSimpleName());
- T v = getValue();
- if (v == null) {
- return null;
+ if (!LegacyPropertyHelper.isLegacyToStringEnabled()) {
+ return super.toString();
+ } else {
+ return LegacyPropertyHelper.legacyPropertyToString(this);
}
- return v.toString();
}
/* Events */