Questions tagged [apache-commons-lang]

The standard Java libraries fail to provide enough methods for manipulation of its core classes. Apache Commons Lang provides these extra methods.

Apache Commons Lang provides a host of helper utilities for the java.lang API, notably string manipulation methods, basic numerical methods, object reflection, concurrency, creation and serialization and System properties. Additionally it contains basic enhancements to java.util.Date and a series of utilities dedicated to help with building methods, such as hashCode(), toString() and equals().

Note that Lang 3.0 (and subsequent versions) use a different package (org.apache.commons.lang3) than the previous versions (org.apache.commons.lang), allowing it to be used at the same time as an earlier version.

Official Website: http://commons.apache.org/lang/

Useful Links:

Related Tags:

80 questions
0
votes
1 answer

Is it bad for performance to use ToStringBuilder.reflectionToString() in my Android project?

I've read that reflection can cause performance issues on Android, so I'm wondering if using the ToStringBuilder.reflectionToString() method would be a bad thing.
Caren
  • 1,358
  • 2
  • 13
  • 22
0
votes
4 answers

StringEscapeUtils cannot be resolved

I am currently attempting to access a code designed by another programmer in my company. My job is to take his code from the jar he designed and make it easier to use for those who are less technologically savvy. The first time I tried to run the…
0
votes
1 answer

How to change a Date based on time-only input and account for time zone and DST?

I need to create a new Java Date based on two strings provided by a user: a date (e.g. "1.1.2015"), and a time of day (e.g. "23:00"). First the user enters the date, which is sent to the server and parsed into a Date (time of day is set to midnight…
Markus Yrjölä
  • 859
  • 1
  • 12
  • 25
0
votes
0 answers

Calculate the Date breakdown without Joda

I am using SimpleDateFormat to get the difference between two Dates and with the new Date I am trying to break that down into days, hours, minutes, seconds, ms without using Joda libraries. I am able to use the apache commons-lang library which…
0
votes
2 answers

apache.commons.lang3.DateUtils.setMonths with December

I am facing very strange issue.. Here is the code, which generates a new Date object: Date result = DateUtils.setYears(new Date(), year); result = DateUtils.setMonths(result, month); return DateUtils.setDays(result, day); If I pass any value for…
nKognito
  • 6,297
  • 17
  • 77
  • 138
0
votes
2 answers

installing apache.commons.lang on MAC jEdit

I need help installing Apache.Commons.Lang on Mac jEdit Steps Taken: I need help installing Apache.Commons.Lang on Mac jEdit. I have downloaded the file from Apache. I tried copying the "commons-lang3-3.3.2.jar" in many locations with no avail. I…
newtrail
  • 1
  • 2
0
votes
2 answers

Convert any number string(int, float, double, long, etc) to appropriate numeric (int, float, double, long, etc) value in java

Is there a better practice to convert any input number string (int, double, etc) to it's respective Wrapper object/primitive type in java? Using valueOf() or parseXXX() methods it can achieved. but I should be knowing the underlying string format…
Diablo
  • 443
  • 7
  • 21
0
votes
1 answer

Using StrSubstitutor to substitue array values

I am trying to use StrSubstituor API to substitute array values. So far, it just ends up substituting the array.toString value. String[] greetings = {"Hello", "World"}; Map valuesMap = new HashMap
Alice
  • 390
  • 2
  • 5
  • 19
0
votes
1 answer

Jboss is not using jboss lib jar commons-lang3-3.0.jar

I am using Ant to build my project and deploy it to JBoss. Ant is building using jboss-home/server/default/lib jars. But during deployment it gives error: java.lang.Error: Unresolved compilation problems: The import org.apache.commons.lang3 cannot…
smali
  • 4,687
  • 7
  • 38
  • 60
0
votes
1 answer

Characters generated by Apache Commons StringEscapeUtils.unescapeHtml cannnot be parsed using StAX

I am trying to parse content of HTML table and write it to CSV. I am trying StaX parser The html contains escaped characters like &nbps' and & I am using org.apache.commons.lang3.StringEscapeUtils to usescape the html line by line and write to…
Aniruddh Joshi
  • 1,705
  • 3
  • 12
  • 18
0
votes
1 answer

SerializationUtils.clone issue in Glassfish 3.1.2.2 build 5

I am cloning my object using SerializationUtils.clone. The same code is working fine in JBOss EAP 6.0. When i did migration to glassfish 3.1.2.2 while processing i am getting below error 2013-12-10 16:55:44,069 ERROR…
Karthik
  • 545
  • 6
  • 23
0
votes
1 answer

parsing error while including taglib

I'm trying to use Apache Commons Lang 3 in my JSF 2 application, and I followed BalusC's example But when I included this line in my .xhtml page : <%@taglib prefix="f" uri="/WEB-INF/functions.tld" %> I have an error while parsing the page…
ThunderPhoenix
  • 1,649
  • 4
  • 20
  • 47
0
votes
1 answer

JPa/Hibernate/JUnit: How to use a proper method of reflection in the ToString?

i would like to test my services in an architecture Spring/JPA/Hibernate via JUnit. All is ok for moment, but i used an overriding method of ToString to verify the content : @Override public String toString() { return…
MychaL
  • 969
  • 4
  • 19
  • 37
0
votes
2 answers

Encoding Javascript

how could I convert a text escaped with StringEscpeUtils.escapeJavascript back to the original text in java? I have converted a russian text with escapeJavascript and the result is: \u041F\u043E\u0440\u043E\u0434\u044B, but backwards it is not…
Iulia Muntianu
  • 145
  • 1
  • 14
-1
votes
1 answer

Why Commons Lang Pair implements Map Entry?

I think I once knew, but I might have ever since forgottoen, or maybe never knew. Do you know why? http://commons.apache.org/proper/commons-lang/javadocs/api-3.10/org/apache/commons/lang3/tuple/Pair.html