What part of Apache Commons saves you the most time?
Community wiki'ed already, folks.
What part of Apache Commons saves you the most time?
I'm curious to get together a list of these to browse and see what I don't know abou开发者_开发百科t, or what I should be using more often than not.
StringUtils.isBlank(String string)
commons-codec - the Base64
and Hex
classes at least.
commons-lang
Since StringUtils has got a lot of static methods, I like to use them using Expression Language (EL) in seam, mapping StringUtils as a component
#{stringutils.left(r.map.job_error, 9)}
In components.xml:
<component name="stringutils" class="org.apache.commons.lang.StringUtils" scope="stateless"/>
IOUtils, specifically FileUtils and IOUtils; it feels like the way that files + streams should have been done. The repetitive work is handled for me, and the code is both quicker to write and clearer to read.
I'm a huge fan of Apache Digester. I like persisting stuff to XML, and I love its rule based XML parser which just gives me the object without effort.
commons-configuration is quite useful when writing configurable code.
FileUpload definitely. The remnant is either relatively easy to homegrow (which thus implies that it doesn't save that much time) or has better alternatives.
ArrayUtils: For my app development this helped the most.
DateUtils. It is so much simpler to use than Java's built in Date and Calendar classes. I don't know what I would do without it!
Apache Commons - provides various reusable components. I frequently use - Collections, IO, Digester, BeanUtils and EXEC.
My vote goes to, StringUtils
which is null safe...
There are some not always so common classes, but can save you time when the need raises:
RandomStringUtils (randomNumeric,randomAlphanumeric ...)
NumberUtils (toInt...)
Dig you can find good stuff there!
精彩评论