Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » [ Databinding ] Error due to two ways of normalization
[ Databinding ] Error due to two ways of normalization [message #673489] Mon, 23 May 2011 19:45 Go to next message
GILLES  élios is currently offline GILLES éliosFriend
Messages: 7
Registered: March 2011
Junior Member
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 Wink

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.
Re: [ Databinding ] Error due to two ways of normalization [message #675536 is a reply to message #673489] Tue, 31 May 2011 15:26 Go to previous message
GILLES  élios is currently offline GILLES éliosFriend
Messages: 7
Registered: March 2011
Junior Member
No replies i'm disappointed Wink
Previous Topic:Which Feature contains the Visual Design Editor for e4?
Next Topic:Rendering MUIElement at Runtime
Goto Forum:
  


Current Time: Fri Apr 19 02:21:10 GMT 2024

Powered by FUDForum. Page generated in 0.02359 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top