IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class MaximumLength

java.lang.Object
  extended by com.ibm.btt.base.FormatElement
      extended by com.ibm.btt.base.FormatDecorator
          extended by com.ibm.btt.base.MaximumLength
All Implemented Interfaces:
Cacheable, java.io.Externalizable, java.io.Serializable

@ATTR(value="length#Integer#IMPLIED")
public class MaximumLength
extends FormatDecorator

This decorator checks that the length of the formatted String does not exceed the limit defined by its maxLength attribute.

See Also:
Serialized Form

Field Summary
 int maxLength
          The maximal length of the format result.
 
Fields inherited from class com.ibm.btt.base.FormatDecorator
decorated
 
Fields inherited from class com.ibm.btt.base.FormatElement
dataElementName, externalizer, name
 
Constructor Summary
MaximumLength()
          This is the default constructor used to create a MaximumLength object.
MaximumLength(java.lang.String aName)
          This is the constructor used by the Externalizer to create a MaximumLength object.
 
Method Summary
 java.lang.String addDecoration(java.lang.String aString)
          Truncates the input String if it is longer than the value of the maxLength attribute.
 int getMaxLength()
          Returns the value of maxLength.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a MaximumLength with the Tag attributes.
 java.lang.String removeDecoration(java.lang.String aString)
          Returns the input String unmodified unless its length exceeds the value of the maxLength attribute.
 void setMaxLength(int aMaxLength)
          Sets the value of maxLength.
 Vector toStrings()
          Returns a visual representation of the decorator.
 int unformat(int ndxFrom, int ndxTo, java.lang.String str, Context ctx)
          Unformat strings that between ndxFrom and ndxTo into the Context.
 int unformat(int ndxFrom, int ndxTo, java.lang.String str, DataElement de)
          Unformat strings that between ndxFrom and ndxTo into the DataElement.
 
Methods inherited from class com.ibm.btt.base.FormatDecorator
extract, format, format, getDataElementName, getDecorated, getName, isConstant, isItConstant, reinitialize, rootDecorated, rootDecorator, setDecorated, toString, unformat, unformat
 
Methods inherited from class com.ibm.btt.base.FormatElement
checkIndexes, exceptionInfo, externalizer, getExternalizer, getTagName, isCacheable, isNull, readExternal, readExternal, readObject, removeExternal, setDataElementName, setExternalizer, setName, setSize, toTags, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

maxLength

public int maxLength
The maximal length of the format result.

Constructor Detail

MaximumLength

public MaximumLength()
This is the default constructor used to create a MaximumLength object.


MaximumLength

public MaximumLength(java.lang.String aName)
              throws java.io.IOException
This is the constructor used by the Externalizer to create a MaximumLength object.

Parameters:
aName - java.lang.String
Throws:
java.io.IOException
Method Detail

addDecoration

public java.lang.String addDecoration(java.lang.String aString)
Truncates the input String if it is longer than the value of the maxLength attribute.

Specified by:
addDecoration in class FormatDecorator
Parameters:
aString - String
Returns:
String

getMaxLength

public int getMaxLength()
Returns the value of maxLength.

Returns:
int

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
Initializes a MaximumLength with the Tag attributes.

Specified by:
initializeFrom in class FormatElement
Parameters:
aTag - com.ibm.btt.base.Tag
Returns:
java.lang.Object

removeDecoration

public java.lang.String removeDecoration(java.lang.String aString)
                                  throws DSEInvalidArgumentException
Returns the input String unmodified unless its length exceeds the value of the maxLength attribute.

Specified by:
removeDecoration in class FormatDecorator
Parameters:
aString - String
Returns:
String
Throws:
DSEInvalidArgumentException

setMaxLength

public void setMaxLength(int aMaxLength)
Sets the value of maxLength.

Parameters:
aMaxLength - int

toStrings

public Vector toStrings()
Returns a visual representation of the decorator.

Specified by:
toStrings in class FormatDecorator
Returns:
java.lang.String

unformat

public int unformat(int ndxFrom,
                    int ndxTo,
                    java.lang.String str,
                    Context ctx)
             throws DSEInvalidRequestException,
                    DSEInvalidArgumentException
Unformat strings that between ndxFrom and ndxTo into the Context.

Overrides:
unformat in class FormatElement
Parameters:
str - java.lang.String
ndxFrom - int
ndxTo - int
ctx - com.ibm.btt.base.Context;
Returns:
int
Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

unformat

public int unformat(int ndxFrom,
                    int ndxTo,
                    java.lang.String str,
                    DataElement de)
             throws DSEInvalidRequestException,
                    DSEInvalidArgumentException
Unformat strings that between ndxFrom and ndxTo into the DataElement.

Overrides:
unformat in class FormatElement
Parameters:
str - java.lang.String
ndxFrom - int
ndxTo - int
de - com.ibm.btt.base.DataElement;
Returns:
int
Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011