commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Mamonov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CODEC-100) Please rename class StringUtils to StringCodec or someting (because there is class with same name in commons-lang)
Date Wed, 19 May 2010 07:15:53 GMT

    [ https://issues.apache.org/jira/browse/CODEC-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869034#action_12869034
] 

Dmitry Mamonov commented on CODEC-100:
--------------------------------------

OK, I give up, but in the end I would like to introduce some code comparison, here is ant's
StringUtils:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java?view=markup

One most obscure method:
61 	 public static Vector split(String data, int ch) {
62 	Vector elems = new Vector();
63 	int pos = -1;
64 	int i = 0;
65 	while ((pos = data.indexOf(ch, i)) != -1) {
66 	String elem = data.substring(i, pos);
67 	elems.addElement(elem);
68 	i = pos + 1;
69 	}
70 	elems.addElement(data.substring(i));
71 	return elems;
72 	} 
Such methods return Vector, the legacy List type,  so the real idea of this Utils class is
to support code compatibility with old java runtimes,
no one outside of "ant" should use this method (if he has a piece of mind at least).

Methods of org.apache.commons.codec.binary.StringUtils is designed to be widely used in any
application, not only
inside "codec" library itself. I think it will be good to name this methods set somehow userfriendly,
"*Utils" means nothing
but scrap-heap.

--
P.S. yes, I know, compatibility with previous library versions is important, but tell to yourself,
if you would start this project
from scratch now, will you put this methods into StringUtil class or you will find some better
name.

> Please rename class StringUtils to StringCodec or someting (because there is class with
same name in commons-lang)
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CODEC-100
>                 URL: https://issues.apache.org/jira/browse/CODEC-100
>             Project: Commons Codec
>          Issue Type: Improvement
>    Affects Versions: 1.4
>            Reporter: Dmitry Mamonov
>
> Duplicate class name in libraries "codec" and "lang":
> org.apache.commons.lang.StringUtils
> org.apache.commons.codec.binary.StringUtils

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message