Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Motsch2020-04-18 09:34:10 +0000
committerRalph Steiner2020-04-18 14:48:48 +0000
commit405c9b5630875a617c693e1f28f3d95c81c0dfd7 (patch)
tree957371e60eefd8a1d159725e86f745d795a4ced7 /org.eclipse.scout.rt.platform
parenteae3d36d6ea95057af4ec2b9ad82d285e51f9dec (diff)
downloadorg.eclipse.scout.rt-405c9b5630875a617c693e1f28f3d95c81c0dfd7.tar.gz
org.eclipse.scout.rt-405c9b5630875a617c693e1f28f3d95c81c0dfd7.tar.xz
org.eclipse.scout.rt-405c9b5630875a617c693e1f28f3d95c81c0dfd7.zip
Use Introspector.decapitalize instead of similar code
Signed-off-by: Ivan Motsch <ivan.motsch@bsiag.com>
Diffstat (limited to 'org.eclipse.scout.rt.platform')
-rw-r--r--org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/reflect/FastBeanUtility.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/reflect/FastBeanUtility.java b/org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/reflect/FastBeanUtility.java
index ea7af860aa..1358d977ba 100644
--- a/org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/reflect/FastBeanUtility.java
+++ b/org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/reflect/FastBeanUtility.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.scout.rt.platform.reflect;
+import java.beans.Introspector;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.AccessController;
@@ -36,14 +37,14 @@ public final class FastBeanUtility {
return Character.toUpperCase(s.charAt(0)) + s.substring(1);
}
+ /**
+ * @deprecated use {@link Introspector#decapitalize(String)}
+ * @param s
+ * @return Introspector#decapitalize(String)
+ */
+ @Deprecated
public static String decapitalize(String s) {
- if (s == null || s.isEmpty()) {
- return "";
- }
- if (s.length() >= 2 && Character.isUpperCase(s.charAt(0)) && Character.isUpperCase(s.charAt(1))) {
- return s;
- }
- return Character.toLowerCase(s.charAt(0)) + s.substring(1);
+ return Introspector.decapitalize(s);
}
public static boolean compareMethods(Method a, Method b) {
@@ -88,7 +89,7 @@ public final class FastBeanUtility {
Matcher matcher = BEAN_METHOD_PAT.matcher(m.getName());
if (matcher.matches()) {
String kind = matcher.group(1);
- String name = decapitalize(matcher.group(2));
+ String name = Introspector.decapitalize(matcher.group(2));
Class<?>[] paramTypes = m.getParameterTypes();
Class<?> retType = m.getReturnType();
//

Back to the top