directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <elecha...@gmail.com>
Subject [Studio] Assigning String to Text widget even if it's null
Date Tue, 04 Aug 2015 10:19:06 GMT
Hi,

a Text widget does not accept null values. It forces us to test if the
value is null, and if so, we inject a "".

I'm willing to add a method in common-ui CommonUIUtils class that do
this check instead of having to test that all over the code. May be
tehre is already such a method spmewhere else ?

Here is what I want to add :

   
   
    /**
     * An utility method that return a String which is never null.
     *
     * @param value The incoming value, which can be null
     * @return The String if it's not null, "" otherwise
     */
    public static String getTextvalue( String value )
    {
        if ( value == null )
        {
            return "";
        }
        else
        {
            return value;
        }
    }

Dead simple...

Let me konw if it's ok.

Thanks !

Mime
View raw message