Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.lang.builder.* (20)org.apache.commons.lang.enum.* (26)
org.apache.commons.lang.enums.* (27)org.apache.commons.lang.exception.* (13)
org.apache.commons.lang.math.* (20)org.apache.commons.lang.mutable.* (16)
org.apache.commons.lang.time.* (11)

org.apache.commons.lang: Javadoc index of package org.apache.commons.lang.


Package Samples:

org.apache.commons.lang.time: Provides highly reusable static utility methods, chiefly concerned with adding value to java.lang and other standard core classes.  
org.apache.commons.lang.exception: Provides highly reusable static utility methods, chiefly concerned with adding value to java.lang and other standard core classes.  
org.apache.commons.lang.builder: Provides highly reusable static utility methods, chiefly concerned with adding value to java.lang and other standard core classes.  
org.apache.commons.lang.enum
org.apache.commons.lang.math
org.apache.commons.lang.enums
org.apache.commons.lang.mutable

Classes:

Enum: Abstract superclass for type-safe enums. One feature of the C programming language lacking in Java is enumerations. The C implementation based on ints was poor and open to abuse. The original Java recommendation and most of the JDK also uses int constants. It has been recognised however that a more robust type-safe class-based solution can be designed. This class follows the basic Java type-safe enumeration pattern. NOTE: Due to the way in which Java ClassLoaders work, comparing Enum objects should always be done using equals() , not == . The equals() method will try == first so in most cases the ...
Enum: Abstract superclass for type-safe enums. One feature of the C programming language lacking in Java is enumerations. The C implementation based on ints was poor and open to abuse. The original Java recommendation and most of the JDK also uses int constants. It has been recognised however that a more robust type-safe class-based solution can be designed. This class follows the basic Java type-safe enumeration pattern. NOTE: Due to the way in which Java ClassLoaders work, comparing Enum objects should always be done using equals() , not == . The equals() method will try == first so in most cases the ...
StringUtils: Operations on java.lang.String that are null safe. IsEmpty/IsBlank - checks if a String contains text Trim/Strip - removes leading and trailing whitespace Equals - compares two strings null-safe IndexOf/LastIndexOf/Contains - null-safe index-of checks IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut - index-of any of a set of Strings ContainsOnly/ContainsNone - does String contains only/none of these characters Substring/Left/Right/Mid - null-safe substring extractions SubstringBefore/SubstringAfter/SubstringBetween - substring extraction relative to other strings Split/Join - splits a ...
ValuedEnum: Abstract superclass for type-safe enums with integer values suitable for use in switch statements. NOTE: Due to the way in which Java ClassLoaders work, comparing Enum objects should always be done using the equals() method, not == . The equals() method will try == first so in most cases the effect is the same. To use this class, it must be subclassed. For example: public final class JavaVersionEnum extends ValuedEnum { //standard enums for version of JVM public static final int JAVA1_0_VALUE = 100; public static final int JAVA1_1_VALUE = 110; public static final int JAVA1_2_VALUE = 120; public ...
ValuedEnum: Abstract superclass for type-safe enums with integer values suitable for use in switch statements. NOTE: Due to the way in which Java ClassLoaders work, comparing Enum objects should always be done using the equals() method, not == . The equals() method will try == first so in most cases the effect is the same. To use this class, it must be subclassed. For example: public final class JavaVersionEnum extends ValuedEnum { //standard enums for version of JVM public static final int JAVA1_0_VALUE = 100; public static final int JAVA1_1_VALUE = 110; public static final int JAVA1_2_VALUE = 120; public ...
ToStringBuilder: Assists in implementing Object.toString() > Object.toString() 55 methods. This class enables a good and consistent toString() to be built for any class or object. This class aims to simplify the process by: allowing field names handling all types consistently handling nulls consistently outputting arrays and multi-dimensional arrays enabling the detail level to be controlled for Objects and Collections handling class hierarchies To use this class write code as follows: public class Person { String name; int age; boolean isSmoker; ... public String toString() { return new ToStringBuilder(this). ...
CompareToBuilder: Assists in implementing Comparable.compareTo(Object) > Comparable.compareTo(Object) 55 methods. It is consistent with equals(Object) and hashcode() built with EqualsBuilder and HashCodeBuilder . Two Objects that compare equal using equals(Object) should normally also compare equal using compareTo(Object) . All relevant fields should be included in the calculation of the comparison. Derived fields may be ignored. The same fields, in the same order, should be used in both compareTo(Object) and equals(Object) . To use this class write code as follows: public class MyClass { String field1; int field2; ...
ReflectionToStringBuilder: Assists in implementing Object.toString() > Object.toString() 55 methods using reflection. This class uses reflection to determine the fields to append. Because these fields are usually private, the class uses AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean) > AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean) 55 to change the visibility of the fields. This will fail under a security manager, unless the appropriate permissions are set up correctly. A typical invocation for this method would look like: public String toString() { return ReflectionToStringBuilder.toString(this); ...
EqualsBuilder: Assists in implementing Object.equals(Object) > Object.equals(Object) 55 methods. This class provides methods to build a good equals method for any class. It follows rules laid out in Effective Java , by Joshua Bloch. In particular the rule for comparing doubles , floats , and arrays can be tricky. Also, making sure that equals() and hashCode() are consistent can be difficult. Two Objects that compare as equals must generate the same hash code, but two Objects with the same hash code do not have to be equal. All relevant fields should be included in the calculation of equals. Derived fields may ...
StopWatch: StopWatch provides a convenient API for timings. To start the watch, call start() 55 . At this point you can: split() 55 the watch to get the time whilst the watch continues in the background. unsplit() 55 will remove the effect of the split. At this point, these three options are available again. suspend() 55 the watch to pause it. resume() 55 allows the watch to continue. Any time between the suspend and resume will not be counted in the total. At this point, these three options are available again. stop() 55 the watch to complete the timing session. It is intended that the output methods toString() ...
NestableException: The base class of all exceptions which can contain other exceptions. It is intended to ease the debugging by carrying on the information about the exception which was caught and provoked throwing the current exception. Catching and rethrowing may occur multiple times, and provided that all exceptions except the first one are descendants of NestedException , when the exception is finally printed out using any of the printStackTrace() methods, the stack trace will contain the information about all exceptions thrown and caught on the way. Running the following program 1 import org.apache.commons.lang.exception.NestableException; ...
HashCodeBuilder: Assists in implementing Object.hashCode() > Object.hashCode() 55 methods. This class enables a good hashCode method to be built for any class. It follows the rules laid out in the book Effective Java by Joshua Bloch. Writing a good hashCode method is actually quite difficult. This class aims to simplify the process. All relevant fields from the object should be included in the hashCode method. Derived fields may be excluded. In general, any field used in the equals method must be used in the hashCode method. To use this class write code as follows: public class Person { String name; int age; boolean ...
ToStringStyle: Controls String formatting for ToStringBuilder . The main public interface is always via ToStringBuilder . These classes are intended to be used as Singletons . There is no need to instantiate a new style each time. A program will generally use one of the predefined constants on this class. Alternatively, the StandardToStringStyle class can be used to set the individual settings. Thus most styles can be achieved without subclassing. If required, a subclass can override as many or as few of the methods as it requires. Each object type (from boolean to long to Object to int[] ) has its own methods ...
CharUtilsPerfTest: Tests the difference in performance between CharUtils and CharSet. Sample runs: Now: Thu Mar 18 14:29:48 PST 2004 Sun Microsystems Inc. Java(TM) 2 Runtime Environment, Standard Edition 1.3.1_10-b03 Sun Microsystems Inc. Java HotSpot(TM) Client VM 1.3.1_10-b03 Windows XP 5.1 x86 pentium i486 i386 Do nohting: 0 milliseconds. run_CharUtils_isAsciiNumeric: 4,545 milliseconds. run_inlined_CharUtils_isAsciiNumeric: 3,417 milliseconds. run_inlined_CharUtils_isAsciiNumeric: 85,679 milliseconds. Now: Thu Mar 18 14:24:51 PST 2004 Sun Microsystems Inc. Java(TM) 2 Runtime Environment, Standard Edition 1.4.2_04-b05 ...
FastDateFormat: FastDateFormat is a fast and thread-safe version of java.text.SimpleDateFormat . This class can be used as a direct replacement to SimpleDateFormat in most formatting situations. This class is especially useful in multi-threaded server environments. SimpleDateFormat is not thread-safe in any JDK version, nor will it be as Sun have closed the bug/RFE. Only formatting is supported, but all patterns are compatible with SimpleDateFormat (except time zones - see below). Java 1.4 introduced a new pattern letter, 'Z' , to represent time zones in RFC822 format (eg. +0800 or -1100 ). This pattern letter ...
IncompleteArgumentException: Thrown to indicate an incomplete argument to a method. This exception supplements the standard IllegalArgumentException by providing a more semantically rich description of the problem. IncompleteArgumentException represents the case where a method takes in a parameter that has a number of properties, some of which have not been set. A case might be a search requirements bean that must have three properties set in order for the method to run, but only one is actually set. This exception would be used in place of IllegalArgumentException , yet it still extends it. public void foo(PersonSearcher ...
IllegalClassException: Thrown when an object is an instance of an unexpected type (a class or interface). This exception supplements the standard IllegalArgumentException by providing a more semantically rich description of the problem. IllegalClassException represents the case where a method takes in a genericly typed parameter like Object (typically because it has to due to some other interface it implements), but this implementation only actually accepts a specific type, for example String. This exception would be used in place of IllegalArgumentException , yet it still extends it. public void foo(Object obj) { if ...
NullArgumentException: Thrown to indicate that an argument was null and should not have been. This exception supplements the standard IllegalArgumentException by providing a more semantically rich description of the problem. NullArgumentException represents the case where a method takes in a parameter that must not be null . Some coding standards would use NullPointerException for this case, others will use IllegalArgumentException . Thus this exception would be used in place of IllegalArgumentException , yet it still extends it. public void foo(String str) { if (str == null) { throw new NullArgumentException("str"); ...
NotImplementedException: Thrown to indicate that a block of code has not been implemented. This exception supplements UnsupportedOperationException by providing a more semantically rich description of the problem. NotImplementedException represents the case where the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. Because this logic might be within a catch block, this exception suports exception chaining. public void foo() { try { // do something that throws an Exception } catch (Exception ex) { // don't know what to do here yet throw new NotImplementedException("TODO", ...
UnhandledException: Thrown when it is impossible or undesirable to consume or throw a checked exception. This exception supplements the standard exception classes by providing a more semantically rich description of the problem. UnhandledException represents the case where a method has to deal with a checked exception but does not wish to. Instead, the checked exception is rethrown in this unchecked wrapper. public void foo() { try { // do something that throws IOException } catch (IOException ex) { // don't want to or can't throw IOException from foo() throw new UnhandledException(ex); } }
NestableDelegate: A shared implementation of the nestable exception functionality. The code is shared between NestableError , NestableException and NestableRuntimeException .
DurationFormatUtils: Duration formatting utilities and constants. The following table describes the tokens used in the pattern language for formatting. character duration element y years M months d days H hours m minutes s seconds S milliseconds
StandardToStringStyle: Works with ToStringBuilder to create a toString . This class is intended to be used as a singleton. There is no need to instantiate a new style each time. Simply instantiate the class once, customize the values as required, and store the result in a public static final variable for the rest of the program to access.
Mutable: Provides mutable access to a value. Mutable is used as a generic interface to the implementations in this package. A typical use case would be to enable a primitive or string to be passed to a method and allow that method to effectively change the value of the primitive/string. Another use case is to store a frequently changing primitive in a collection (for example a total in a map) without needing to create new Integer/Long wrapper objects.

Home | Contact Us | Privacy Policy | Terms of Service