createDate(java.lang.String aString)
Methods inherited from class com.ibm.btt.base.KeyedCollectionFormat |
add, addElementAt, addFirst, at, checkIndexes, format, format, getDataElementEmpty, getElements, getEnumeration, reinitialize, removeAll, removeAt, setElements, size, unformat, unformat |
Methods inherited from class com.ibm.btt.base.FormatElement |
exceptionInfo, externalizer, extract, getDataElementName, getExternalizer, getName, getTagName, isCacheable, isConstant, isItConstant, isNull, readExternal, readExternal, readObject, removeExternal, rootDecorated, setDataElementName, setExternalizer, setName, setSize, toTags, writeExternal, writeExternal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
datePattern
protected java.lang.String datePattern
- The pattern to be used to format/unformat dates *
escape
protected java.lang.String escape
pointers
java.util.Vector pointers
- The set of pointers used in the format. *
context
Context context
- Initial context to start the search of context pointed by a DataPointer. *
DynamicXMLFormat
public DynamicXMLFormat()
createDate
protected java.util.Date createDate(java.lang.String aString)
throws DSEInvalidRequestException
- Creates a date from aString with dataConverter dd/MM/yy/hh/mm/ss
- Parameters:
aString - java.lang.String
- Returns:
- java.util.Date
- Throws:
DSEInvalidRequestException
createNumber
protected java.lang.Object createNumber(java.lang.String aString,
char type)
- Creates a number from aString and type char.
- Parameters:
aString - java.lang.String
- Returns:
- java.util.Date
extractElement
public java.lang.String[] extractElement(java.lang.String elementName,
java.lang.String aString)
- Extracts the element from aString named elementName.
- Parameters:
elementName - java.lang.StringaString - java.lang.String
formatContext
public java.lang.String formatContext(Context aContext)
throws DSEInvalidClassException,
DSEInvalidRequestException,
DSEInvalidArgumentException
- Formats a Context into an XML compliant format.
- Specified by:
formatContext in class KeyedCollectionFormat
- Parameters:
aContext - java.lang.String
- Returns:
- java.lang.String
- Throws:
DSEInvalidClassException
DSEInvalidRequestException
DSEInvalidArgumentException
formatDateXml
protected java.lang.String formatDateXml(java.util.Date aDate)
throws DSEInvalidArgumentException
- Formats a Date with the pattern: dd/MM/yy/hh/mm/ss.
- Parameters:
aDate - java.util.Date
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
formatHashtableXml
public java.lang.String formatHashtableXml(java.util.Hashtable aHashtable)
throws DSEInvalidArgumentException
- Formats a KeyedCollection into an XML compliant format.
- Parameters:
aHashtable - java.util.Hashtable
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
formatKeyedCollection
public java.lang.String formatKeyedCollection(KeyedCollection aKeyedCollection)
throws DSEInvalidClassException,
DSEInvalidRequestException,
DSEInvalidArgumentException
- Formats a KeyedCollection into an XML compliant format.
- Specified by:
formatKeyedCollection in class KeyedCollectionFormat
- Parameters:
aKeyedCollection - java.lang.String
- Returns:
- java.lang.String
- Throws:
DSEInvalidClassException
DSEInvalidRequestException
DSEInvalidArgumentException
formatNumberXml
protected java.lang.String formatNumberXml(java.lang.Number aNumber)
- Formats a Number into the default format of the number.
- Parameters:
aNumber - java.lang.Number
- Returns:
- java.lang.String
formatVectorXml
public java.lang.String formatVectorXml(java.util.Vector aVector)
throws DSEInvalidArgumentException
- Formats a Vector into an XML compliant format.
- Throws:
DSEInvalidArgumentException
getContext
public Context getContext(java.lang.String aString)
- Extracts the ContextName attribute from a Tag and returns this context if
it exists.
- Parameters:
aString - java.lang.String
- Returns:
- Context
getCreateOnUnformat
public java.lang.String getCreateOnUnformat()
- Obtains createOnUnformat attribute.
- Returns:
- java.lang.String
getDatePattern
public java.lang.String getDatePattern()
- Gets the datePattern attribute.
- Returns:
- java.lang.String
getElementName
protected java.lang.String getElementName(java.lang.String aString)
- Obtains element name.
- Parameters:
aString - java.lang.String
- Returns:
- java.lang.String
getInsertOnFormat
public java.lang.String getInsertOnFormat()
- Obtains insertOnFormat.
- Returns:
- java.lang.String
getEscape
public java.lang.String getEscape()
- Obtains the value of the escape attribute.
- Returns:
- java.lang.String
getPointers
public java.util.Vector getPointers()
- Obtains the DataPointers.
- Returns:
- java.util.Vector
getPostDataFieldTag
protected java.lang.String getPostDataFieldTag(DataField data)
- Constructs the tag after each dataField.
- Parameters:
data - com.ibm.btt.base.DataField
- Returns:
- java.lang.String
getPostIndexedCollectionTag
protected java.lang.String getPostIndexedCollectionTag(IndexedCollection data)
- Constructs the tag after each IndexedCollection.
- Parameters:
data - com.ibm.btt.base.IndexedCollection
- Returns:
- java.lang.String
getPostKeyedCollectionTag
protected java.lang.String getPostKeyedCollectionTag(KeyedCollection data)
- Constructs the tag after each KeyedCollection.
- Parameters:
data - com.ibm.btt.base.KeyedCollection
- Returns:
- java.lang.String
getPreDataFieldTag
protected java.lang.String getPreDataFieldTag(DataField data)
- Constructs the tag before each DataField.
- Parameters:
data - com.ibm.btt.base.DataField
- Returns:
- java.lang.String
getPreIndexedCollectionTag
protected java.lang.String getPreIndexedCollectionTag(IndexedCollection data)
- Constructs the tag before each IndexedCollection.
- Parameters:
data - com.ibm.btt.base.IndexedCollection
- Returns:
- java.lang.String
getPreKeyedCollectionTag
protected java.lang.String getPreKeyedCollectionTag(KeyedCollection data)
- Constructs the tag before each KeyedCollection.
- Parameters:
data - com.ibm.btt.base.KeyedCollection
- Returns:
- java.lang.String
getType
protected java.lang.String getType(java.lang.String aString)
- Obtains the type of this field.
- Parameters:
aString - com.ibm.btt.base.DataField
- Returns:
- java.lang.String
initializeFrom
public java.lang.Object initializeFrom(Tag aTag)
throws java.io.IOException
- Initializes an XMLFormat with the Tag attributes.
- Specified by:
initializeFrom in class FormatElement
- Parameters:
aTag - com.ibm.btt.base.Tag
- Returns:
- java.lang.Object
- Throws:
java.io.IOException.
java.io.IOException
insertKCollOnFormat
public boolean insertKCollOnFormat()
- Returns true if the insertKCollOnFormat is set to yes.
- Returns:
- boolean
isDate
protected boolean isDate(java.lang.String aString)
- Identifies a Date.
- Parameters:
aString - java.lang.String
- Returns:
- boolean
isHashtable
protected boolean isHashtable(java.lang.String aString)
- Identifies a java.util.Hashtable.
- Parameters:
aString - java.lang.String
- Returns:
- boolean
isIndexedCollection
public boolean isIndexedCollection(java.lang.String aString)
- Identifies an IndexedCollection.
- Parameters:
aString - java.lang.String
- Returns:
- boolean
isKeyedCollection
public boolean isKeyedCollection(java.lang.String aString)
- Identifies a KeyedCollection.
- Parameters:
aString - java.lang.String
- Returns:
- boolean
isNull
protected boolean isNull(java.lang.String aString)
- Identifies a null.
- Parameters:
aString - java.lang.String
- Returns:
- boolean
isNumber
public boolean isNumber(java.lang.String aString)
- Identifies a number.
- Parameters:
aString - java.lang.String
- Returns:
- boolean
isString
protected boolean isString(java.lang.String aString)
- Identifies a String.
- Parameters:
aString - java.lang.String
- Returns:
- boolean
isVector
protected boolean isVector(java.lang.String aString)
- Identifies a java.util.Vector.
- Parameters:
aString - java.lang.String
- Returns:
- boolean
isEscape
public boolean isEscape()
- Check whether the formatter are required to escape the format result or
unescape the input string before unformatting.
- Returns:
- boolean
parseDataElementAsXml
protected java.lang.String parseDataElementAsXml(java.lang.Object data)
throws DSEInvalidArgumentException
- Selects the method to invoke depending on the argument data
class.
- Parameters:
data - java.lang.Object
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
parseDataFieldAsXml
protected java.lang.String parseDataFieldAsXml(DataField data)
throws DSEInvalidArgumentException
- Converts a dataField to an XML format.
- Parameters:
data - com.ibm.btt.base.DataField
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
parseIndexedCollectionAsXml
protected java.lang.String parseIndexedCollectionAsXml(IndexedCollection data)
throws DSEInvalidArgumentException
- Converts IndexedCollection to an XML format.
- Parameters:
data - com.ibm.btt.base.IndexedCollection
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
parseKeyedCollectionAsXml
protected java.lang.String parseKeyedCollectionAsXml(KeyedCollection data)
throws DSEInvalidArgumentException
- Converts KeyedCollection to an XML format.
- Parameters:
data - com.ibm.btt.base.KeyedCollection
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
parseOtherDataAsXml
protected java.lang.String parseOtherDataAsXml(java.lang.Object data)
throws DSEInvalidArgumentException
- Prepares Parser for other data.
- Parameters:
data - java.lang.Object
- Returns:
- java.lang.String
- Throws:
com.ibm.btt.base.DSEInvalidArgumentException.
DSEInvalidArgumentException
parsePointerAsXml
protected java.lang.String parsePointerAsXml(java.lang.Object data,
java.lang.String ContextName)
throws DSEInvalidArgumentException
- Selects the method to invoke depending on the argument data
class.
- Parameters:
data - java.lang.Object
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
setCreateOnUnformat
public void setCreateOnUnformat(java.lang.String aString)
- Sets the createOnUnformat property value.
- Parameters:
aString - - See Also:
getCreateOnUnformat()
setDatePattern
public void setDatePattern(java.lang.String newPattern)
- Sets the datePattern attribute to the newPattern
- Parameters:
newPattern - java.lang.String
setInsertOnFormat
public void setInsertOnFormat(java.lang.String aString)
- Sets the insertOnFormat property value.
- Parameters:
aString - - See Also:
getInsertOnFormat()
setEscape
public void setEscape(java.lang.String newEscape)
setPointers
public void setPointers(java.util.Vector v)
- Sets the pointers property (Vector) value.
- Parameters:
v - The new value for the property.- See Also:
getPointers()
toString
public java.lang.String toString()
- Returns a String representating the format.
- Overrides:
toString in class FormatElement
- Returns:
- java.lang.String
toStrings
public Vector toStrings()
- Returns a visual representation of this format.
- Overrides:
toStrings in class FormatElement
- Returns:
- com.ibm.btt.base.Vector
unformatContext
public DataElement unformatContext(java.lang.String aString,
Context aContext)
throws DSEInvalidRequestException,
DSEInvalidArgumentException
- Unformats a XML String and stores it in the context aContext.
- Specified by:
unformatContext in class KeyedCollectionFormat
- Parameters:
aString - java.lang.StringaContext - com.ibm.btt.base.Context
- Returns:
- com.ibm.btt.base.DataElement
- Throws:
DSEInvalidRequestException
DSEInvalidArgumentException
unformatKeyedCollection
public KeyedCollection unformatKeyedCollection(java.lang.String aString,
KeyedCollection aKeyedCollection)
throws DSEInvalidRequestException,
DSEInvalidArgumentException
- Unformats an XML String and stores it in aKeyedCollection.
- Specified by:
unformatKeyedCollection in class KeyedCollectionFormat
- Parameters:
aString - java.lang.StringaKeyedCollection - com.ibm.btt.base.KeyedCollection
- Returns:
- com.ibm.btt.base.KeyedCollection
- Throws:
DSEInvalidRequestException
DSEInvalidArgumentException
unformat
public int unformat(int ndxFrom,
int ndxTo,
java.lang.String aString,
Context aContext)
throws DSEInvalidRequestException,
DSEInvalidArgumentException
- Unformats a XML String and stores it in the context aContext.
- Overrides:
unformat in class KeyedCollectionFormat
- Parameters:
ndxFrom - is the initial indexndxTo - intaString - StringaContext - Context
- Returns:
- int
- Throws:
DSEInvalidRequestException
DSEInvalidArgumentException
unformat
public int unformat(int ndxFrom,
int ndxTo,
java.lang.String str,
DataElement de)
throws DSEInvalidRequestException,
DSEInvalidArgumentException
- Unformats an XML String and stores it in aKeyedCollection.
- Overrides:
unformat in class KeyedCollectionFormat
- Parameters:
ndxFrom - is the initial indexndxTo - one is the final index
- Throws:
DSEInvalidRequestException
DSEInvalidArgumentException
unformatKeyedCollection
public int unformatKeyedCollection(int ndxFrom,
int ndxTo,
java.lang.String aString,
KeyedCollection aKeyedCollection)
throws DSEInvalidRequestException,
DSEInvalidArgumentException
- Unformats an XML String and stores it in aKeyedCollection.
- Throws:
DSEInvalidRequestException
DSEInvalidArgumentException
getNdxFrom
protected int getNdxFrom(int ndxFrom,
java.lang.String elementName,
java.lang.String aString)
- get the initial index .
getNdxTo
protected int getNdxTo(int ndxFrom,
java.lang.String elementName,
java.lang.String aString)
- get the end index .
escape
protected java.lang.String escape(java.lang.String msg)
unescape
protected java.lang.String unescape(java.lang.String msg)
- Replace special characters with XML escapes:
- Parameters:
string - The string to be escaped.
- Returns:
- The escaped string.
- Throws:
java.io.UnsupportedEncodingException
(c) Copyright IBM Corporation 1998, 2009
|