| Home >> All >> org >> apache >> commons >> lang >> [ builder Javadoc ] |
org.apache.commons.lang.builder: Javadoc index of package org.apache.commons.lang.builder.
Package Samples:
org.apache.commons.lang.builder: Provides highly reusable static utility methods, chiefly concerned with adding value to java.lang and other standard core classes.
Classes:
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 ...
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 ...
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.
HashCodeBuilderAndEqualsBuilderTest: Tests HashCodeBuilder and EqualsBuilderTest to insure that equal objects must have equal hash codes.
NoFieldNamesToStringStyleTest: Unit tests NoFieldNamesToStringStyleTest .
MultiLineToStringStyleTest: Unit tests MultiLineToStringStyleTest .
DefaultToStringStyleTest: Unit tests DefaultToStringStyleTest .
SimpleToStringStyleTest: Unit tests SimpleToStringStyleTest .
ToStringBuilderTest: Unit tests for ToStringBuilder .
CompareToBuilderTest: Unit tests CompareToBuilder .
HashCodeBuilderTest: Unit tests HashCodeBuilder .
EqualsBuilderTest: Unit tests EqualsBuilder .
StandardToStringStyleTest: Unit tests ToStringStyle .
ShortPrefixToStringStyleTest: Unit tests org.apache.commons.lang.builder.ToStringStyle.SHORT_PREFIX_STYLE .
| Home | Contact Us | Privacy Policy | Terms of Service |