aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/commons/lang3/builder
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/apache/commons/lang3/builder')
-rw-r--r--src/org/apache/commons/lang3/builder/Builder.java44
-rw-r--r--src/org/apache/commons/lang3/builder/CompareToBuilder.java52
-rw-r--r--src/org/apache/commons/lang3/builder/IDKey.java24
-rw-r--r--src/org/apache/commons/lang3/builder/StandardToStringStyle.java70
4 files changed, 95 insertions, 95 deletions
diff --git a/src/org/apache/commons/lang3/builder/Builder.java b/src/org/apache/commons/lang3/builder/Builder.java
index 1d9037e..1bd8f0c 100644
--- a/src/org/apache/commons/lang3/builder/Builder.java
+++ b/src/org/apache/commons/lang3/builder/Builder.java
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,52 +18,52 @@ package org.apache.commons.lang3.builder;
/**
* <p>
- * The Builder interface is designed to designate a class as a <em>builder</em>
- * object in the Builder design pattern. Builders are capable of creating and
- * configuring objects or results that normally take multiple steps to construct
- * or are very complex to derive.
+ * The Builder interface is designed to designate a class as a <em>builder</em>
+ * object in the Builder design pattern. Builders are capable of creating and
+ * configuring objects or results that normally take multiple steps to construct
+ * or are very complex to derive.
* </p>
- *
+ *
* <p>
- * The builder interface defines a single method, {@link #build()}, that
- * classes must implement. The result of this method should be the final
+ * The builder interface defines a single method, {@link #build()}, that
+ * classes must implement. The result of this method should be the final
* configured object or result after all building operations are performed.
* </p>
- *
+ *
* <p>
- * It is a recommended practice that the methods supplied to configure the
+ * It is a recommended practice that the methods supplied to configure the
* object or result being built return a reference to {@code this} so that
* method calls can be chained together.
* </p>
- *
+ *
* <p>
* Example Builder:
* <code><pre>
* class FontBuilder implements Builder&lt;Font&gt; {
* private Font font;
- *
+ *
* public FontBuilder(String fontName) {
* this.font = new Font(fontName, Font.PLAIN, 12);
* }
- *
+ *
* public FontBuilder bold() {
* this.font = this.font.deriveFont(Font.BOLD);
* return this; // Reference returned so calls can be chained
* }
- *
+ *
* public FontBuilder size(float pointSize) {
* this.font = this.font.deriveFont(pointSize);
* return this; // Reference returned so calls can be chained
* }
- *
+ *
* // Other Font construction methods
- *
+ *
* public Font build() {
* return this.font;
* }
* }
* </pre></code>
- *
+ *
* Example Builder Usage:
* <code><pre>
* Font bold14ptSansSerifFont = new FontBuilder(Font.SANS_SERIF).bold()
@@ -71,18 +71,18 @@ package org.apache.commons.lang3.builder;
* .build();
* </pre></code>
* </p>
- *
+ *
* @param <T> the type of object that the builder will construct or compute.
- *
+ *
* @since 3.0
* @version $Id: Builder.java 1088899 2011-04-05 05:31:27Z bayard $
*/
public interface Builder<T> {
/**
- * Returns a reference to the object being constructed or result being
+ * Returns a reference to the object being constructed or result being
* calculated by the builder.
- *
+ *
* @return the object constructed or result calculated by the builder.
*/
public T build();
diff --git a/src/org/apache/commons/lang3/builder/CompareToBuilder.java b/src/org/apache/commons/lang3/builder/CompareToBuilder.java
index 7d86d98..3f87f70 100644
--- a/src/org/apache/commons/lang3/builder/CompareToBuilder.java
+++ b/src/org/apache/commons/lang3/builder/CompareToBuilder.java
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ import java.util.Comparator;
import org.apache.commons.lang3.ArrayUtils;
-/**
+/**
* Assists in implementing {@link java.lang.Comparable#compareTo(Object)} methods.
*
* It is consistent with <code>equals(Object)</code> and
@@ -86,7 +86,7 @@ import org.apache.commons.lang3.ArrayUtils;
* @version $Id: CompareToBuilder.java 1090813 2011-04-10 15:03:23Z mbenson $
*/
public class CompareToBuilder implements Builder<Integer> {
-
+
/**
* Current state of the comparison as appended fields are checked.
*/
@@ -95,8 +95,8 @@ public class CompareToBuilder implements Builder<Integer> {
/**
* <p>Constructor for CompareToBuilder.</p>
*
- * <p>Starts off assuming that the objects are equal. Multiple calls are
- * then made to the various append methods, followed by a call to
+ * <p>Starts off assuming that the objects are equal. Multiple calls are
+ * then made to the various append methods, followed by a call to
* {@link #toComparison} to get the result.</p>
*/
public CompareToBuilder() {
@@ -105,11 +105,11 @@ public class CompareToBuilder implements Builder<Integer> {
}
//-----------------------------------------------------------------------
- /**
+ /**
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -139,7 +139,7 @@ public class CompareToBuilder implements Builder<Integer> {
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -171,7 +171,7 @@ public class CompareToBuilder implements Builder<Integer> {
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -204,7 +204,7 @@ public class CompareToBuilder implements Builder<Integer> {
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -237,7 +237,7 @@ public class CompareToBuilder implements Builder<Integer> {
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -266,10 +266,10 @@ public class CompareToBuilder implements Builder<Integer> {
* @since 2.2 (2.0 as <code>reflectionCompare(Object, Object, boolean, Class)</code>)
*/
public static int reflectionCompare(
- Object lhs,
- Object rhs,
- boolean compareTransients,
- Class<?> reflectUpToClass,
+ Object lhs,
+ Object rhs,
+ boolean compareTransients,
+ Class<?> reflectUpToClass,
String... excludeFields) {
if (lhs == rhs) {
@@ -294,7 +294,7 @@ public class CompareToBuilder implements Builder<Integer> {
/**
* <p>Appends to <code>builder</code> the comparison of <code>lhs</code>
* to <code>rhs</code> using the fields defined in <code>clazz</code>.</p>
- *
+ *
* @param lhs left-hand object
* @param rhs right-hand object
* @param clazz <code>Class</code> that defines fields to be compared
@@ -309,7 +309,7 @@ public class CompareToBuilder implements Builder<Integer> {
CompareToBuilder builder,
boolean useTransients,
String[] excludeFields) {
-
+
Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (int i = 0; i < fields.length && builder.comparison == 0; i++) {
@@ -345,7 +345,7 @@ public class CompareToBuilder implements Builder<Integer> {
comparison = superCompareTo;
return this;
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Appends to the <code>builder</code> the comparison of
@@ -357,7 +357,7 @@ public class CompareToBuilder implements Builder<Integer> {
* a <code>null</code> object is less than a non-<code>null</code> object</li>
* <li>Check the object contents</li>
* </ol>
- *
+ *
* <p><code>lhs</code> must either be an array or implement {@link Comparable}.</p>
*
* @param lhs left-hand object
@@ -486,7 +486,7 @@ public class CompareToBuilder implements Builder<Integer> {
/**
* Appends to the <code>builder</code> the comparison of
* two <code>short</code>s.
- *
+ *
* @param lhs left-hand value
* @param rhs right-hand value
* @return this - used to chain append calls
@@ -518,7 +518,7 @@ public class CompareToBuilder implements Builder<Integer> {
/**
* Appends to the <code>builder</code> the comparison of
* two <code>byte</code>s.
- *
+ *
* @param lhs left-hand value
* @param rhs right-hand value
* @return this - used to chain append calls
@@ -620,7 +620,7 @@ public class CompareToBuilder implements Builder<Integer> {
public CompareToBuilder append(Object[] lhs, Object[] rhs) {
return append(lhs, rhs, null);
}
-
+
/**
* <p>Appends to the <code>builder</code> the deep comparison of
* two <code>Object</code> arrays.</p>
@@ -995,7 +995,7 @@ public class CompareToBuilder implements Builder<Integer> {
* the <code>builder</code> has judged the "left-hand" side
* as less than, greater than, or equal to the "right-hand"
* side.
- *
+ *
* @return final comparison result
*/
public int toComparison() {
@@ -1007,9 +1007,9 @@ public class CompareToBuilder implements Builder<Integer> {
* the <code>builder</code> has judged the "left-hand" side
* as less than, greater than, or equal to the "right-hand"
* side.
- *
+ *
* @return final comparison result
- *
+ *
* @since 3.0
*/
public Integer build() {
diff --git a/src/org/apache/commons/lang3/builder/IDKey.java b/src/org/apache/commons/lang3/builder/IDKey.java
index 6b1d4ee..2db08ad 100644
--- a/src/org/apache/commons/lang3/builder/IDKey.java
+++ b/src/org/apache/commons/lang3/builder/IDKey.java
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.commons.lang3.builder;
@@ -21,13 +21,13 @@ package org.apache.commons.lang3.builder;
// adapted from org.apache.axis.utils.IDKey
/**
- * Wrap an identity key (System.identityHashCode())
+ * Wrap an identity key (System.identityHashCode())
* so that an object can only be equal() to itself.
- *
+ *
* This is necessary to disambiguate the occasional duplicate
* identityHashCodes that can occur.
- *
- */
+ *
+ */
final class IDKey {
private final Object value;
private final int id;
@@ -35,12 +35,12 @@ final class IDKey {
/**
* Constructor for IDKey
* @param _value The value
- */
+ */
public IDKey(Object _value) {
- // This is the Object hashcode
- id = System.identityHashCode(_value);
- // There have been some cases (LANG-459) that return the
- // same identity hash code for different objects. So
+ // This is the Object hashcode
+ id = System.identityHashCode(_value);
+ // There have been some cases (LANG-459) that return the
+ // same identity hash code for different objects. So
// the value is also added to disambiguate these cases.
value = _value;
}
@@ -48,7 +48,7 @@ final class IDKey {
/**
* returns hashcode - i.e. the system identity hashcode.
* @return the hashcode
- */
+ */
@Override
public int hashCode() {
return id;
@@ -58,7 +58,7 @@ final class IDKey {
* checks if instances are equal
* @param other The other object to compare to
* @return if the instances are for the same object
- */
+ */
@Override
public boolean equals(Object other) {
if (!(other instanceof IDKey)) {
diff --git a/src/org/apache/commons/lang3/builder/StandardToStringStyle.java b/src/org/apache/commons/lang3/builder/StandardToStringStyle.java
index cec4f09..a6bf63d 100644
--- a/src/org/apache/commons/lang3/builder/StandardToStringStyle.java
+++ b/src/org/apache/commons/lang3/builder/StandardToStringStyle.java
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,10 +29,10 @@ package org.apache.commons.lang3.builder;
* @version $Id: StandardToStringStyle.java 1089740 2011-04-07 05:01:54Z bayard $
*/
public class StandardToStringStyle extends ToStringStyle {
-
+
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 1L;
@@ -43,9 +43,9 @@ public class StandardToStringStyle extends ToStringStyle {
public StandardToStringStyle() {
super();
}
-
+
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to use the class name.</p>
*
@@ -67,7 +67,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to output short or long class names.</p>
*
@@ -91,7 +91,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to use the identity hash code.</p>
* @return the current useIdentityHashCode flag
@@ -112,7 +112,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to use the field names passed in.</p>
*
@@ -134,7 +134,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to use full detail when the caller doesn't
* specify.</p>
@@ -158,7 +158,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to output array content detail.</p>
*
@@ -168,7 +168,7 @@ public class StandardToStringStyle extends ToStringStyle {
public boolean isArrayContentDetail() { // NOPMD as this is implementing the abstract class
return super.isArrayContentDetail();
}
-
+
/**
* <p>Sets whether to output array content detail.</p>
*
@@ -180,7 +180,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the array start text.</p>
*
@@ -205,7 +205,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the array end text.</p>
*
@@ -230,7 +230,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the array separator text.</p>
*
@@ -255,7 +255,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the content start text.</p>
*
@@ -280,7 +280,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the content end text.</p>
*
@@ -305,7 +305,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the field name value separator text.</p>
*
@@ -330,7 +330,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the field separator text.</p>
*
@@ -355,11 +355,11 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
- * <p>Gets whether the field separator should be added at the start
+ * <p>Gets whether the field separator should be added at the start
* of each buffer.</p>
- *
+ *
* @return the fieldSeparatorAtStart flag
* @since 2.0
*/
@@ -369,9 +369,9 @@ public class StandardToStringStyle extends ToStringStyle {
}
/**
- * <p>Sets whether the field separator should be added at the start
+ * <p>Sets whether the field separator should be added at the start
* of each buffer.</p>
- *
+ *
* @param fieldSeparatorAtStart the fieldSeparatorAtStart flag
* @since 2.0
*/
@@ -381,11 +381,11 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
- * <p>Gets whether the field separator should be added at the end
+ * <p>Gets whether the field separator should be added at the end
* of each buffer.</p>
- *
+ *
* @return fieldSeparatorAtEnd flag
* @since 2.0
*/
@@ -395,9 +395,9 @@ public class StandardToStringStyle extends ToStringStyle {
}
/**
- * <p>Sets whether the field separator should be added at the end
+ * <p>Sets whether the field separator should be added at the end
* of each buffer.</p>
- *
+ *
* @param fieldSeparatorAtEnd the fieldSeparatorAtEnd flag
* @since 2.0
*/
@@ -407,7 +407,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the text to output when <code>null</code> found.</p>
*
@@ -432,7 +432,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the text to output when a <code>Collection</code>,
* <code>Map</code> or <code>Array</code> size is output.</p>
@@ -463,7 +463,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* Gets the end text to output when a <code>Collection</code>,
* <code>Map</code> or <code>Array</code> size is output.</p>
@@ -494,7 +494,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the start text to output when an <code>Object</code> is
* output in summary mode.</p>
@@ -525,7 +525,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the end text to output when an <code>Object</code> is
* output in summary mode.</p>
@@ -556,5 +556,5 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
}