commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r639556 - /commons/proper/lang/trunk/xdocs/article2_4.xml
Date Fri, 21 Mar 2008 07:17:42 GMT
Author: bayard
Date: Fri Mar 21 00:17:18 2008
New Revision: 639556

Adding an article on Lang 2.4 to link to in the announcement. Needs an ExtendedMessageFormat

    commons/proper/lang/trunk/xdocs/article2_4.xml   (with props)

Added: commons/proper/lang/trunk/xdocs/article2_4.xml
--- commons/proper/lang/trunk/xdocs/article2_4.xml (added)
+++ commons/proper/lang/trunk/xdocs/article2_4.xml Fri Mar 21 00:17:18 2008
@@ -0,0 +1,122 @@
+<?xml version="1.0"?>
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+See the License for the specific language governing permissions and
+limitations under the License.
+ <properties>
+  <title>What's new in 2.4?</title>
+  <author email="">Commons Documentation Team</author>
+ </properties>
+<section name="What's new in 2.4?">
+<p>Commons Lang 2.4 is out, and the obvious question is: <i>"So what? What's
changed?"</i>. </p>
+<p>Thus this article aims to briefly cover the changes and save you from having to
dig into each JIRA 
+issue to see what went on in the year of development between Lang 2.3 and 2.4. </p>
+<section name="Deprecations">
+<p>First, let us start with a couple of deprecations. As you can see in the release
notes, we chose 
+to deprecate the <a href=",%20java.lang.Object)"><code>ObjectUtils.appendIdentityToString(StringBuffer,
Object)</code></a> method as its 
+null handling did not match its design (see <a href="">LANG-360</a>

+for more details. Instead users should use <code>ObjectUtils.identityToString(StringBuffer,
Object)</code>. </p>
+<p>We also deprecated <a href=",%20int,%20int)"><code>DateUtils.add(java.util.Date,
int, int)</code></a>. It should have been <code>private</code> 
+from the beginning and please let us know if you actually use it. </p>
+<section name="The build">
+<p>Before we move on - a quick note on the build - we built 2.4 using Maven 2 and Java
1.4. We also tested that the Ant build passed the tests 
+successfully under Java 1.3, and that the classes compiled under Java 1.2. As it's been so
long, we stopped building a Java 1.1 compatible jar. Most importantly - it should be a drop
in replacement for Lang 2.3, but we recommend testing first of course. Now... moving on. </p>
+<section name="New classes">
+<p>Three new classes were added, so let's cover those next. </p>
+<p>Firstly, we added an <a href=""><code>IEEE754rUtils</code></a>
+class to the <code>org.apache.commons.lang.math</code> package. 
+This candidate for ugly name of the month was needed to add <a href="">IEEE-754r</a>

+semantics for some of the <code>NumberUtils</code> methods. The relevant part
of that 
+IEEE specification in this case is the NaN handling for <code>min</code> and
<code>max</code> methods, and 
+you can read more about it in <a href="">LANG-381</a>.

+<p>Second and third on our newcomers list are the <a href=""><code>ExtendedMessageFormat</code></a>
class and its peer 
+<a href=""><code>FormatFactory</code></a>
+interface, both found in the <code>org.apache.commons.lang.text</code> package.
+<p>Together they allow you to take the <code>java.text.MessageFormat</code>
class further and insert your own formatting elements. </p>
+<p>TODO: Insert example. </p>
+<section name="New methods">
+<p>There were 58 new methods added to existing Commons Lang classes. Going through
each one, one at a time would be dull, 
+and fortunately there are some nice groupings that we can discuss instead: </p>
+<p><b>CharSet getInstance(String[])</b> adds an additional builder method
by which you can build a CharSet from multiple sets of characters at the same time. If you
weren't aware of the CharSet class, it holds a set of characters created by a simple pattern
language allowing constructs such as <code>"a-z"</code> and <code>"^a"</code>
(everything but 'a'). It's most used by the CharSetUtils class, and came out of CharSetUtils.translate,
a simple variant of the UNIX tr command. 
+<a href="[])"><img
+<p><b>ClassUtils Canonical name methods</b> are akin to the non '<code>Canonical</code>'
methods, except they work with the more human readable <code>int[]</code> type
names rather than the JVM versions of <code>[I</code>. This makes them useful
for parsing input from developer's configuration files. 
+<a href=""><img
+<p><b>ClassUtils toClass(String[])</b> is very easy to explain - it calls
<code>toClass</code> on each <code>Object</code> in the array and
returns an array of <code>Class</code> objects. 
+<a href="[])"><img
+<p><b>ClassUtils wrapper-&gt;primitive conversions</b> are the reflection
of the pre-existing <code>primitiveToWrapper</code> methods. Again easy to explain,
they turn an array of <code>Integer</code> into an array of <code>int[]</code>.

+<a href="[])"><img
+<p><b>ObjectUtils identityToString(StringBuffer, Object)</b> is the StringBuffer
variant of the pre-existing <code>identityToString</code> method. In case you've
not met tht before, it produces the toString that would have been produced by an Object if
it hadn't been overridden. 
+<a href=",%20java.lang.Object)"><img
+<p><b>StringEscapeUtils CSV methods</b> are a new addition to our range
of simple parser/printers. These, quite as expected, parse and unparse CSV text as per <a
+<a href=""><img
+<p><b>StringUtils</b> has a host of new methods, as always, and we'll leave
these for later. </p>
+<p><b>WordUtils abbreviate</b> finds the first space after the lower limit
and abbreviates the text. 
+<a href=",%20int,%20int,%20java.lang.String)"><img
+<p><b>math.IntRange/LongRange.toArray</b> turn the range into an array
of primitive <code>int</code>/<code>long</code>s contained in the
+<a href=""><img
+<a href=""><img
+<p><b>text.StrMatch.isMatch(char[], int)</b> is a helper method for checking
whether there was a match with the StrMatcher objects. 
+<a href="[],%20int)"><img
+<p><b>time.DateFormatUtils format(Calendar, ...)</b> provide Calendar variants
for the pre-existing format methods. If these are new to you, they are helper methods to formatting
a date. 
+<a href=""><img
+<p><b>time.DateUtils getFragment* methods</b> are used to splice the time
element out of Date. If you have <code>2008/12/13 14:57</code>, then these could,
for example, pull out the 13. 
+<a href=""><img
+<p><b>time.DateUtils setXxx methods</b> round off our walk through the
methods - the setXxx variant of the existing addXxx helper methods. 
+<a href=""><img
+<section name="StringUtils methods">
+<p>The <code>StringUtils</code> class is a little large isn't it. Sorry,
but it's got bigger. </p>
+  <li>boolean containsAny(String, char[]) <a href=",%20char[])"><img
+  <li>boolean containsAny(String, String) <a href=",%20java.lang.String)"><img
+  <li>boolean endsWith(String, String) <a href=",%20java.lang.String)"><img
+  <li>boolean endsWithIgnoreCase(String, String) <a href=",%20java.lang.String)"><img
+  <li>String getCommonPrefix(String[]) <a href="[])"><img
+  <li>int indexOfDifference(String[]) <a href="[])"><img
+  <li>int length(String) <a href=""><img
+  <li>String removeEndIgnoreCase(String, String) <a href=",%20java.lang.String)"><img
+  <li>String removeStartIgnoreCase(String, String) <a href=",%20java.lang.String)"><img
+  <li>String replaceEach(String, String[], String[]) <a href=",%20java.lang.String[],%20java.lang.String[])"><img
+  <li>String replaceEachRepeatedly(String, String[], String[]) <a href=",%20java.lang.String[],%20java.lang.String[])"><img
+  <li>String[] splitByCharacterType(String) <a href=""><img
+  <li>String[] splitByCharacterTypeCamelCase(String) <a href=""><img
+  <li>String[] splitByWholeSeparatorPreserveAllTokens(String, String) <a href=",%20java.lang.String)"><img
+  <li>String[] splitByWholeSeparatorPreserveAllTokens(String, String, int) <a href=",%20java.lang.String,%20int)"><img
+  <li>boolean startsWith(String, String) <a href=",%20java.lang.String)"><img
+  <li>boolean startsWithIgnoreCase(String, String) <a href=",%20java.lang.String)"><img
+<p>Hopefully they are in many cases self-describing. Rather than spend a lot of time
describing them, we'll let you read the Javadoc of the ones that interest you. </p>
+<section name="So long, farewell...">
+<p>Hopefully that was of interest. Don't forget to download <a href="download_lang.cgi">Lang
2.4</a>, or, for the Maven repositor users, upgrade your &lt;version&gt; tag
to 2.4. Please feel free to raise any questions you might have on the <a href="mail-lists.html">mailing
lists</a>, and report bugs or enhancements in the <a href="issue-tracking.html">issue
tracker</a>. </p>

Propchange: commons/proper/lang/trunk/xdocs/article2_4.xml
    svn:eol-style = native

View raw message