Hello, guys
I'm working right now on some E4 XWT application and i've got some problem with databinding on some objects. Indeed there are two differents ways to normalize a propertyName, the one used by java.beans.Introspector :
/**
* Utility method to take a string and convert it to normal Java variable
* name capitalization. This normally means converting the first
* character from upper case to lower case, but in the (unusual) special
* case when there is more than one character and both the first and
* second characters are upper case, we leave it alone.
* <p>
* Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays
* as "URL".
*
* @param name The string to be decapitalized.
* @return The decapitalized version of the string.
*/
public static String decapitalize(String name) {
if (name == null || name.length() == 0) {
return name;
}
if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) &&
Character.isUpperCase(name.charAt(0))){
return name;
}
char chars[] = name.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);
}
and the one used by ModelUtils in XWT :
public class ModelUtils {
public static String normalizeEventName(String name) {
return name.toLowerCase();
}
public static String normalizePropertyName(String name) {
if (name == null || name.length() == 0) {
return name;
}
char c = name.charAt(0);
if (Character.isLowerCase(c)) {
return name;
}
return Character.toLowerCase(name.charAt(0)) + name.substring(1);
}
}
For instance if one of the method in my objects is called getTOTO(), the java.beans.Introspector will return a propertyName "TOTO" when the XWT ModelUtils will return "tOTO" and as it's an "equal" who does the comparaison ,we've got a problem here
So i would like to know if for you it's a bug and i need to report it in bugzilla or what ?
Thx guy's.