diff options
author | Artur Signell <artur@vaadin.com> | 2015-05-27 22:03:26 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-05-29 13:33:47 +0000 |
commit | ed5ad86b114ccb4d6ab08e19a734bdb8b3342399 (patch) | |
tree | fa6bfdda2d616589acc2205ad3da84e9f513a691 /server | |
parent | 4a79c3c5c5cf14dde6f696a0fe924227d00a0ec5 (diff) | |
download | vaadin-framework-ed5ad86b114ccb4d6ab08e19a734bdb8b3342399.tar.gz vaadin-framework-ed5ad86b114ccb4d6ab08e19a734bdb8b3342399.zip |
Ensure method and property names are capitalized using English locale (#13389)
Change-Id: Idde4fc54950f2bb83e0bb8d36a84a5bf075eb8de
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/data/util/MethodProperty.java | 11 | ||||
-rw-r--r-- | server/src/com/vaadin/data/util/NestedMethodProperty.java | 8 |
2 files changed, 7 insertions, 12 deletions
diff --git a/server/src/com/vaadin/data/util/MethodProperty.java b/server/src/com/vaadin/data/util/MethodProperty.java index 853f68b711..83279afa53 100644 --- a/server/src/com/vaadin/data/util/MethodProperty.java +++ b/server/src/com/vaadin/data/util/MethodProperty.java @@ -26,6 +26,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.vaadin.data.Property; +import com.vaadin.shared.util.SharedUtil; import com.vaadin.util.SerializerHelper; /** @@ -189,11 +190,7 @@ public class MethodProperty<T> extends AbstractProperty<T> { // Assure that the first letter is upper cased (it is a common // mistake to write firstName, not FirstName). - if (Character.isLowerCase(beanPropertyName.charAt(0))) { - final char[] buf = beanPropertyName.toCharArray(); - buf[0] = Character.toUpperCase(buf[0]); - beanPropertyName = new String(buf); - } + beanPropertyName = SharedUtil.capitalize(beanPropertyName); // Find the get method getMethod = null; @@ -534,8 +531,7 @@ public class MethodProperty<T> extends AbstractProperty<T> { */ static Method initGetterMethod(String propertyName, final Class<?> beanClass) throws NoSuchMethodException { - propertyName = propertyName.substring(0, 1).toUpperCase() - + propertyName.substring(1); + propertyName = SharedUtil.capitalize(propertyName); Method getMethod = null; try { @@ -772,4 +768,5 @@ public class MethodProperty<T> extends AbstractProperty<T> { private static final Logger getLogger() { return Logger.getLogger(MethodProperty.class.getName()); } + } diff --git a/server/src/com/vaadin/data/util/NestedMethodProperty.java b/server/src/com/vaadin/data/util/NestedMethodProperty.java index 0493812861..29fe62f845 100644 --- a/server/src/com/vaadin/data/util/NestedMethodProperty.java +++ b/server/src/com/vaadin/data/util/NestedMethodProperty.java @@ -26,6 +26,7 @@ import java.util.List; import com.vaadin.data.Property; import com.vaadin.data.util.MethodProperty.MethodException; +import com.vaadin.shared.util.SharedUtil; /** * Nested accessor based property for a bean. @@ -164,11 +165,8 @@ public class NestedMethodProperty<T> extends AbstractProperty<T> { try { // Assure that the first letter is upper cased (it is a common // mistake to write firstName, not FirstName). - if (Character.isLowerCase(lastSimplePropertyName.charAt(0))) { - final char[] buf = lastSimplePropertyName.toCharArray(); - buf[0] = Character.toUpperCase(buf[0]); - lastSimplePropertyName = new String(buf); - } + lastSimplePropertyName = SharedUtil + .capitalize(lastSimplePropertyName); setMethod = lastClass.getMethod("set" + lastSimplePropertyName, new Class[] { type }); |