commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory" <ggreg...@seagullsw.com>
Subject [lang] CharUtils.isAscii methods and CharSet, two issues
Date Thu, 11 Mar 2004 00:41:55 GMT
Hello,

Looking at the new CharUtils class and its isAscii methods and the
CharSet class, something feels slightly off.

(1)
The first thing is that the isAscii* could be implemented in terms of
already existing CharSet code. 

For example, in CharUtils:

    public static boolean isAsciiAlphaUpper(char ch) {
        return (ch >= 'A' && ch <= 'Z');
    }

Eating our own dog food:

    public static boolean isAsciiAlphaUpper(char ch) {
        return CharSet.ASCII_ALPHA_UPPER.contains(ch);
    }

(2)
The second item that I am wondering about is the introduction of methods
like is{Encoding}SomeCondition(char). This is believe is not OO. One
should ask the question to some encoding object, which is what CharSet
looks to be for.

Would it make sense to improve CharSet with these condition methods such
that one could write:

CharSet.ASCII.isAlphaUpper(ch)
CharSet.ASCII.isWhatever(ch)

?

Thank you,
Gary


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message