aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java')
-rw-r--r--server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java b/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java
index 129e1aefea..00364dbbc9 100644
--- a/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java
+++ b/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java
@@ -37,18 +37,34 @@ public class StringToLongConverter
extends AbstractStringToNumberConverter<Long> {
/**
- * Creates a new converter instance with the given error message.
+ * Creates a new converter instance with the given error message. Empty
+ * strings are converted to <code>null</code>.
*
* @param errorMessage
* the error message to use if conversion fails
*/
public StringToLongConverter(String errorMessage) {
- super(errorMessage);
+ this(null, errorMessage);
}
/**
- * Returns the format used by {@link #convertToPresentation(Object, ValueContext)}
- * and {@link #convertToModel(String, ValueContext)}.
+ * Creates a new converter instance with the given empty string value and
+ * error message.
+ *
+ * @param emptyValue
+ * the presentation value to return when converting an empty
+ * string, may be <code>null</code>
+ * @param errorMessage
+ * the error message to use if conversion fails
+ */
+ public StringToLongConverter(Long emptyValue, String errorMessage) {
+ super(emptyValue, errorMessage);
+ }
+
+ /**
+ * Returns the format used by
+ * {@link #convertToPresentation(Object, ValueContext)} and
+ * {@link #convertToModel(String, ValueContext)}.
*
* @param locale
* The locale to use