Better JavaDoc for HashCodeExclude
This commit is contained in:
parent
758f5677a1
commit
0e67448f8b
|
@ -94,6 +94,9 @@ import org.apache.commons.lang3.Validate;
|
||||||
* return HashCodeBuilder.reflectionHashCode(this);
|
* return HashCodeBuilder.reflectionHashCode(this);
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
|
* <p>The {@link HashCodeExclude} annotation can be used to exclude fields from being
|
||||||
|
* used by the <code>reflectionHashCode</code> methods.</p>
|
||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -246,6 +249,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
||||||
* if the Object is <code>null</code>
|
* if the Object is <code>null</code>
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if the number is zero or even
|
* if the number is zero or even
|
||||||
|
*
|
||||||
|
* @see HashCodeExclude
|
||||||
*/
|
*/
|
||||||
public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object) {
|
public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object) {
|
||||||
return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, false, null);
|
return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, false, null);
|
||||||
|
@ -290,6 +295,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
||||||
* if the Object is <code>null</code>
|
* if the Object is <code>null</code>
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if the number is zero or even
|
* if the number is zero or even
|
||||||
|
*
|
||||||
|
* @see HashCodeExclude
|
||||||
*/
|
*/
|
||||||
public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object,
|
public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object,
|
||||||
final boolean testTransients) {
|
final boolean testTransients) {
|
||||||
|
@ -342,6 +349,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
||||||
* if the Object is <code>null</code>
|
* if the Object is <code>null</code>
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if the number is zero or even
|
* if the number is zero or even
|
||||||
|
*
|
||||||
|
* @see HashCodeExclude
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public static <T> int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final T object,
|
public static <T> int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final T object,
|
||||||
|
@ -392,6 +401,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
||||||
* @return int hash code
|
* @return int hash code
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if the object is <code>null</code>
|
* if the object is <code>null</code>
|
||||||
|
*
|
||||||
|
* @see HashCodeExclude
|
||||||
*/
|
*/
|
||||||
public static int reflectionHashCode(final Object object, final boolean testTransients) {
|
public static int reflectionHashCode(final Object object, final boolean testTransients) {
|
||||||
return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object,
|
return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object,
|
||||||
|
@ -430,6 +441,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
||||||
* @return int hash code
|
* @return int hash code
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if the object is <code>null</code>
|
* if the object is <code>null</code>
|
||||||
|
*
|
||||||
|
* @see HashCodeExclude
|
||||||
*/
|
*/
|
||||||
public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) {
|
public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) {
|
||||||
return reflectionHashCode(object, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
|
return reflectionHashCode(object, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
|
||||||
|
@ -469,6 +482,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
||||||
* @return int hash code
|
* @return int hash code
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if the object is <code>null</code>
|
* if the object is <code>null</code>
|
||||||
|
*
|
||||||
|
* @see HashCodeExclude
|
||||||
*/
|
*/
|
||||||
public static int reflectionHashCode(final Object object, final String... excludeFields) {
|
public static int reflectionHashCode(final Object object, final String... excludeFields) {
|
||||||
return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, false,
|
return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, false,
|
||||||
|
|
|
@ -23,7 +23,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this annotation to builds a hash code excluding the annotated field.
|
* Use this annotation to exclude a field from being being used by
|
||||||
|
* the various <code>reflectionHashcode</code> methods defined on
|
||||||
|
* {@link HashCodeBuilder}.
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.FIELD)
|
@Target(ElementType.FIELD)
|
||||||
|
|
Loading…
Reference in New Issue