com.googlecode.ehcache.annotations
Class ParameterMask

java.lang.Object
  extended by com.googlecode.ehcache.annotations.ParameterMask

public class ParameterMask
extends java.lang.Object

Represents a mask for method parameters, tracking which parameters are included in the mask by a boolean array. Two utility methods are included which can mask or unmask a parameter array.

Version:
$Revision: 656 $
Author:
Eric Dalquist

Field Summary
static ParameterMask NO_MASK
           
 
Method Summary
static ParameterMask create(boolean[] mask)
           
 boolean equals(java.lang.Object obj)
           
 boolean[] getMask()
           
 int hashCode()
           
 java.lang.Object[] maskParameters(java.lang.Object[] parameters)
          Masks a parameter array.
 boolean shouldMask()
          If no parameters are marked to be masked or all parameters are marked to be masked masking serves no purpose.
 java.lang.String toString()
           
 void unmaskParameters(java.lang.Object[] originalParameters, java.lang.Object[] maskedParameters)
          Mutates the originalParameters array by copying values from the maskedParameters array back into their original locations.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_MASK

public static final ParameterMask NO_MASK
Method Detail

create

public static ParameterMask create(boolean[] mask)

shouldMask

public boolean shouldMask()
If no parameters are marked to be masked or all parameters are marked to be masked masking serves no purpose. In that case this method will return false and maskParameters(Object[]) will simply return its argument.

Returns:
true if this mask will result in a change to a masked parameter array. False if not.

getMask

public boolean[] getMask()
Returns:
A copy of the mask array

maskParameters

public java.lang.Object[] maskParameters(java.lang.Object[] parameters)
Masks a parameter array. The returned array will have size equal to the number of true values in the mask. Only the parameter values from the source array that have a corresponding true value in the mask will be in the returned array.

See Also:
shouldMask

unmaskParameters

public void unmaskParameters(java.lang.Object[] originalParameters,
                             java.lang.Object[] maskedParameters)
Mutates the originalParameters array by copying values from the maskedParameters array back into their original locations.


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011. All Rights Reserved.