{"id":736,"date":"2010-08-04T10:54:27","date_gmt":"2010-08-04T08:54:27","guid":{"rendered":"http:\/\/www.tutego.de\/blog\/javainsel\/2010\/08\/commons-lang-3-0-in-beta-und-endlich-angepasst-auf-java-5\/"},"modified":"2010-08-04T10:54:27","modified_gmt":"2010-08-04T08:54:27","slug":"commons-lang-3-0-in-beta-und-endlich-angepasst-auf-java-5","status":"publish","type":"post","link":"https:\/\/www.tutego.de\/blog\/javainsel\/2010\/08\/commons-lang-3-0-in-beta-und-endlich-angepasst-auf-java-5\/","title":{"rendered":"Commons Lang 3.0 in Beta und (endlich) angepasst auf Java 5"},"content":{"rendered":"<p>Aus <a href=\"http:\/\/commons.apache.org\/lang\/article3_0.html\">http:\/\/commons.apache.org\/lang\/article3_0.html<\/a>:<\/p>\n<blockquote>\n<h4>What&#8217;s new in Commons Lang 3.0?<\/h4>\n<p>Commons Lang 3.0 is <strong>(not yet)<\/strong> out, and the obvious question is: <i>&quot;So what? What&#8217;s changed?&quot;<\/i>.<\/p>\n<h4><a name=\"The_big_story\"><\/a>The big story<\/h4>\n<p>Lang is now Java 5 based. We&#8217;ve generified the API, moved certain APIs to support <code>varargs<\/code>and thrown out any features that are now supported by Java itself. We&#8217;ve removed the deprecated parts of the API and have also removed some features that were deemed weak or unnecessary. All of this means that Lang 3.0 is not backwards compatible.<\/p>\n<p>To that end we have changed the package name, allowing Lang 3.0 to sit side-by-side with your previous version of Lang without any bad side effects. The new package name is the exciting and original <code>org.apache.commons.lang3<\/code>.<\/p>\n<p>There are also, as you&#8217;d expect, new features, enhancements and bugs fixed.<\/p>\n<h4><a name=\"The_build\"><\/a>The build<\/h4>\n<p>We built 3.0 using Maven 2.2.1 and Java 1.5. <strong>Needs confirmation before release of actual build details<\/strong><\/p>\n<h4><a name=\"Migrating_from_2.x\"><\/a>Migrating from 2.x<\/h4>\n<p>Despite the label of backwards incompatibility, in the vast majority of cases the simple addition of a <code>'3'<\/code> to an import statement will suffice for your migration. For example, using Perl:<\/p>\n<p>find . -type f -name &#8218;*.java&#8216; | xargs perl -pi -e &#8217;s\/org\\.apache\\.commons\\.lang\\.\/org.apache.commons.lang3.\/g&#8216;<\/p>\n<p>Maven users will need to update the groupId from <code>commons-lang<\/code> to <code>org.apache.commons<\/code>, and the artifactId from <code>commons-lang<\/code> to <code>commons-lang3<\/code>.<\/p>\n<h4><a name=\"Whats_gone\"><\/a>What&#8217;s gone?<\/h4>\n<p>Enum package &#8211; Java 5 provided enums out of the box, therefore we dispensed with both the deprecated enum package, and the enums package. Instead you should migrate over to the standard Java enum. An EnumUtils class has been born from the ashes of the old code, focused on providing additional functionality to the standard Java enum API.<\/p>\n<p>NestedExceptions &#8211; In Java 1.4, the notion that all Throwables could be linked to a cause was introduced. In Lang we had provided a NestedException framework to support the same feature, and now that we&#8217;re jumping from Java 1.3 to Java 5 we are remove this feature. The deprecation section below covers one part of ExceptionUtils that remains until we are on Java 6, where the last remaining parts of the JDK appear to have embraced the new cause API.<\/p>\n<p>JVMRandom &#8211; This class was introduced in Lang 2.0 to support a Random object built around the system seed. This proved to be both an uncommon use case and one with bugs and so was dropped.<\/p>\n<p>StringEscapeUtils.escapeSql &#8211; This was a misleading method, only handling the simplest of possible SQL cases. As SQL is not Lang&#8217;s focus, it didn&#8217;t make sense to improve this method.<\/p>\n<p>Various Exception classes were removed &#8211; the lesson in defining more semantically relevant exception classes is that you can keep on coming up with more and more new classes. Simpler to focus on using the main JDK classes.<\/p>\n<p>The various Range classes in the <code>math<\/code> package were removed in favour of a new Range class.<\/p>\n<p>All deprecated fields\/methods\/classes &#8211; with a new major version, all of the previously deprecated parts of the API could finally go away.<\/p>\n<p>If you feel that something was unfairly taken away, please feel free to contact the list. In many cases the possibility exists to reintroduce code.<\/p>\n<h4><a name=\"Deprecations\"><\/a>Deprecations<\/h4>\n<p>The lone deprecation in 3.0 is that of the notion of &#8218;cause method names&#8216; in ExceptionUtils. In Java 5.0 it is still just about needed to handle some JDK classes that have not been migrated to the getCause API. In Java 6.0 things appear to be resolved and we will remove the related methods in Lang 4.0.<\/p>\n<h4><a name=\"New_packages\"><\/a>New packages<\/h4>\n<p>Two new packages have shown up. org.apache.commons.lang3.concurrent, which unsurprisingly provides support classes for multi-threaded programming, and org.apache.commons.lang3.text.translate, which provides a pluggable API for text transformation.<\/p>\n<p>TODO: Add examples<\/p>\n<h4><a name=\"New_classes\"><\/a>New classes<\/h4>\n<p><code>CharSequenceUtils<\/code><\/p>\n<p><code>EnumUtils<\/code><\/p>\n<p><code>Pair<\/code><\/p>\n<p><code>Range<\/code><\/p>\n<p><code>builder.Builder<\/code><\/p>\n<p><code>exception.ContextedException<\/code><\/p>\n<p><code>exception.CloneFailedException<\/code><\/p>\n<p><code>reflect.ConstructorUtils<\/code><\/p>\n<p><code>reflect.FieldUtils<\/code><\/p>\n<p><code>reflect.MethodUtils<\/code><\/p>\n<p><code>reflect.TypeUtils<\/code><\/p>\n<p><code>text.WordUtils<\/code><\/p>\n<h4><a name=\"New_methods\"><\/a>New methods<\/h4>\n<h4><a name=\"Whats_fixed_in_Lang_3.0\"><\/a>What&#8217;s fixed in Lang 3.0?<\/h4>\n<\/blockquote>\n<p>Weitere \u00c4nderungen: <a href=\"http:\/\/commons.apache.org\/lang\/upgradeto3_0.html\">http:\/\/commons.apache.org\/lang\/upgradeto3_0.html<\/a>.<\/p>\n<p>So und wann kommt nun Common Collections f\u00fcr Java 5?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Aus http:\/\/commons.apache.org\/lang\/article3_0.html: What&#8217;s new in Commons Lang 3.0? Commons Lang 3.0 is (not yet) out, and the obvious question is: &quot;So what? What&#8217;s changed?&quot;. The big story Lang is now Java 5 based. We&#8217;ve generified the API, moved certain APIs to support varargsand thrown out any features that are now supported by Java itself. We&#8217;ve [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[4],"tags":[],"class_list":["post-736","post","type-post","status-publish","format-standard","hentry","category-open-source"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/comments?post=736"}],"version-history":[{"count":0,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/736\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/media?parent=736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/categories?post=736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/tags?post=736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}