public class CreditCardTagConverter extends java.lang.Object implements TagConverter
Here is an example of how to use this:
<valueof param="paymentGroup.creditCardNumber" CreditCard>no number</valueof>
<valueof param="paymentGroup.creditCardNumber" CreditCard maskCharacter="#" numCharsUnmasked="6" groupingSize="2">no number</valueof>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
static java.lang.String |
NAME |
Constructor and Description |
---|
CreditCardTagConverter()
Empty Constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
convertObjectToString(DynamoHttpServletRequest pRequest,
java.lang.Object pValue,
java.util.Properties pAttributes)
Convert the supplied credit card number to a string that is proper
for displaying to the end user.
|
java.lang.Object |
convertStringToObject(DynamoHttpServletRequest pRequest,
java.lang.String pValue,
java.util.Properties pAttributes)
This just ensures that if the property is required that it has been supplied.
|
java.lang.String |
formatCreditCard(java.lang.Object pCreditCard,
java.util.Properties pAttributes)
Format and return the credit card object so that it is suitable
for display to the end user.
|
java.lang.Integer |
getGroupingSize() |
java.lang.String |
getMaskChar() |
java.lang.String |
getName()
Returns the name of this converter.
|
java.lang.Integer |
getNumCharsUnmasked() |
TagAttributeDescriptor[] |
getTagAttributeDescriptors()
Returns the list of TagAttributeDescriptors which are used by this
converter.
|
void |
setGroupingSize(java.lang.Integer pGroupingSize) |
void |
setMaskChar(java.lang.String pMaskChar) |
void |
setNumCharsUnmasked(java.lang.Integer pNumCharsUnmasked) |
public static java.lang.String CLASS_VERSION
public static final java.lang.String NAME
public void setMaskChar(java.lang.String pMaskChar)
public java.lang.String getMaskChar()
public void setNumCharsUnmasked(java.lang.Integer pNumCharsUnmasked)
public java.lang.Integer getNumCharsUnmasked()
public void setGroupingSize(java.lang.Integer pGroupingSize)
public java.lang.Integer getGroupingSize()
public java.lang.String getName()
getName
in interface TagConverter
public TagAttributeDescriptor[] getTagAttributeDescriptors()
TagConverter
getTagAttributeDescriptors
in interface TagConverter
public java.lang.String convertObjectToString(DynamoHttpServletRequest pRequest, java.lang.Object pValue, java.util.Properties pAttributes) throws TagConversionException
The character tat is used to mask out all of the digits is optionally supplied, but defaults to an 'X'.
convertObjectToString
in interface TagConverter
pRequest
- a value of type 'DynamoHttpServletRequest'pValue
- a value of type 'Object'pAttributes
- a value of type 'Properties'TagConversionException
- if an error occurspublic java.lang.Object convertStringToObject(DynamoHttpServletRequest pRequest, java.lang.String pValue, java.util.Properties pAttributes) throws TagConversionException
convertStringToObject
in interface TagConverter
pRequest
- the servlet request objectpValue
- the credit card numberpAttributes
- attributes passed in via jhtmlTagConversionException
- if an error occurspublic java.lang.String formatCreditCard(java.lang.Object pCreditCard, java.util.Properties pAttributes)
If more characters are being masked than there are to be masked, it will default to masking all characters. A space will be inserted after each grouping, by default every fourth character in the string returned.
pCreditCard
- an object that should represent the Credit Card numberpAttributes
- attributes passed into TagConverter via jhtml