public class ISOMsg extends ISOComponent implements java.lang.Cloneable, Loggeable, java.io.Externalizable
ISOComponent,
ISOField,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected int |
direction |
protected boolean |
dirty |
protected int |
fieldNumber |
protected java.util.Map<java.lang.Integer,java.lang.Object> |
fields |
protected ISOHeader |
header |
static int |
INCOMING |
protected int |
maxField |
protected boolean |
maxFieldDirty |
static int |
OUTGOING |
protected ISOPackager |
packager |
protected byte[] |
trailer |
| Constructor and Description |
|---|
ISOMsg()
Creates an ISOMsg
|
ISOMsg(int fieldNumber)
Creates a nested ISOMsg
|
ISOMsg(java.lang.String mti)
Creates an ISOMsg with given mti
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
java.lang.Object |
clone(int... fields)
Partially clone an ISOMsg
|
ISOMsg |
clone(java.lang.String... fpaths)
Partially clone an ISOMsg by field paths
|
void |
dump(java.io.PrintStream p,
java.lang.String indent)
dump the message to a PrintStream.
|
byte[] |
getBytes(int fldno)
Return the byte[] value associated with the given ISOField number
|
byte[] |
getBytes(java.lang.String fpath)
Return the String value associated with the given field path
|
java.util.Map |
getChildren()
clone fields
|
ISOComponent |
getComponent(int fldno)
get the component associated with the given field number
|
ISOComponent |
getComponent(java.lang.String fpath)
get the component associated with the given field number
|
ISOComponent |
getComposite()
In order to interchange Composites and Leafs we use
getComposite().
|
int |
getDirection() |
int |
getFieldNumber() |
byte[] |
getHeader()
get optional message header image
|
ISOHeader |
getISOHeader()
Return this messages ISOHeader
|
java.lang.Object |
getKey()
valid on Leafs only.
|
int |
getMaxField()
a Composite must override this function
|
java.lang.String |
getMTI() |
ISOPackager |
getPackager() |
ISOSource |
getSource() |
java.lang.String |
getString(int fldno)
Return the String value associated with the given ISOField number
|
java.lang.String |
getString(java.lang.String fpath)
Return the String value associated with the given field path
|
byte[] |
getTrailer()
Get optional trailer image.
|
java.lang.Object |
getValue()
valid on Leafs only.
|
java.lang.Object |
getValue(int fldno)
Return the object value associated with the given field number
|
java.lang.Object |
getValue(java.lang.String fpath)
Return the object value associated with the given field path
|
boolean |
hasAny(int[] fields)
Check if the message has any of these fields
|
boolean |
hasAny(java.lang.String... fields)
Check if the message has any of these fields
|
boolean |
hasField(int fldno)
Check if a given field is present
|
boolean |
hasField(java.lang.String fpath)
Check if a field indicated by a fpath is present
|
boolean |
hasFields() |
boolean |
hasFields(int[] fields)
Check if all fields are present
|
boolean |
hasMTI() |
boolean |
isAdministrative() |
boolean |
isAuthorization() |
boolean |
isChargeback() |
boolean |
isFeeCollection() |
boolean |
isFileAction() |
boolean |
isFinancial() |
boolean |
isIncoming() |
boolean |
isInner() |
boolean |
isNetworkManagement() |
boolean |
isOutgoing() |
boolean |
isReconciliation() |
boolean |
isRequest() |
boolean |
isResponse() |
boolean |
isRetransmission() |
boolean |
isReversal() |
void |
merge(ISOMsg m) |
void |
merge(ISOMsg m,
boolean mergeHeader)
Merges the content of the specified ISOMsg into this ISOMsg instance.
|
void |
move(int oldFieldNumber,
int newFieldNumber)
moves a field (renumber)
|
byte[] |
pack()
pack the message with the current packager
|
protected void |
readDirection(java.io.ObjectInput in) |
void |
readExternal(java.io.ObjectInput in) |
protected void |
readHeader(java.io.ObjectInput in) |
protected void |
readPackager(java.io.ObjectInput in) |
void |
recalcBitMap()
setup BitMap
|
void |
set(int fldno,
byte[] value)
Creates an ISOBinaryField associated with fldno within this ISOMsg.
|
void |
set(int fldno,
java.lang.String value)
Creates an ISOField associated with fldno within this ISOMsg.
|
void |
set(ISOComponent c)
Set a field within this message
|
void |
set(java.lang.String fpath,
byte[] value)
Creates an ISOField associated with fldno within this ISOMsg.
|
void |
set(java.lang.String fpath,
ISOComponent c)
Creates an ISOField associated with fldno within this ISOMsg
|
void |
set(java.lang.String fpath,
java.lang.String value)
Creates an ISOField associated with fldno within this ISOMsg.
|
void |
setDirection(int direction)
Sets the direction information related to this message
|
void |
setFieldNumber(int fieldNumber)
changes this Component field number
Use with care, this method does not change any reference held by a Composite. |
void |
setHeader(byte[] b)
Sets an optional message header image
|
void |
setHeader(ISOHeader header) |
void |
setMTI(java.lang.String mti) |
void |
setPackager(ISOPackager p) |
void |
setResponseMTI()
sets an appropriate response MTI.
|
void |
setRetransmissionMTI()
sets an appropriate retransmission MTI
|
void |
setSource(ISOSource source)
Let this ISOMsg object hold a weak reference to an ISOSource
(usually used to carry a reference to the incoming ISOChannel)
|
void |
setTrailer(byte[] trailer)
Sets optional trailer data.
|
void |
setValue(java.lang.Object obj)
Don't call setValue on an ISOMsg.
|
java.lang.String |
toString() |
int |
unpack(byte[] b)
unpack a message
|
void |
unpack(java.io.InputStream in) |
void |
unset(int... flds)
Unsets several fields at once
|
void |
unset(int fldno)
Unset a field if it exists, otherwise ignore.
|
void |
unset(java.lang.String... fpaths)
Unset a set of fields referenced by fpaths, if any of them exist.
|
void |
unset(java.lang.String fpath)
Unset a field referenced by a fpath if it exists, otherwise ignore.
|
protected void |
writeDirection(java.io.ObjectOutput out) |
void |
writeExternal(java.io.ObjectOutput out) |
protected void |
writeHeader(java.io.ObjectOutput out) |
protected void |
writePackager(java.io.ObjectOutput out) |
getBytes, packprotected java.util.Map<java.lang.Integer,java.lang.Object> fields
protected int maxField
protected ISOPackager packager
protected boolean dirty
protected boolean maxFieldDirty
protected int direction
protected ISOHeader header
protected byte[] trailer
protected int fieldNumber
public static final int INCOMING
public static final int OUTGOING
public ISOMsg()
public ISOMsg(int fieldNumber)
fieldNumber - (in the outer ISOMsg) of this nested messagepublic ISOMsg(java.lang.String mti)
mti - Msg's MTIpublic void setFieldNumber(int fieldNumber)
setFieldNumber in class ISOComponentfieldNumber - new field numberpublic void setDirection(int direction)
direction - can be either ISOMsg.INCOMING or ISOMsg.OUTGOINGpublic void setHeader(byte[] b)
b - header imagepublic void setHeader(ISOHeader header)
public byte[] getHeader()
public void setTrailer(byte[] trailer)
trailer - The trailer data.BaseChannel.getMessageTrailer(ISOMsg).,
BaseChannel.sendMessageTrailer(ISOMsg, byte[]).public byte[] getTrailer()
public ISOHeader getISOHeader()
public int getDirection()
ISOChannelpublic boolean isIncoming()
ISOChannelpublic boolean isOutgoing()
ISOChannelpublic int getMaxField()
ISOComponentgetMaxField in class ISOComponentpublic void setPackager(ISOPackager p)
p - - a peer packagerpublic ISOPackager getPackager()
public void set(ISOComponent c) throws ISOException
set in class ISOComponentc - - a componentISOExceptionpublic void set(int fldno,
java.lang.String value)
fldno - field numbervalue - field valuepublic void set(java.lang.String fpath,
java.lang.String value)
fpath - dot-separated field path (i.e. 63.2)value - field valuepublic void set(java.lang.String fpath,
ISOComponent c)
throws ISOException
fpath - dot-separated field path (i.e. 63.2)c - componentISOException - on errorpublic void set(java.lang.String fpath,
byte[] value)
fpath - dot-separated field path (i.e. 63.2)value - binary field valuepublic void set(int fldno,
byte[] value)
fldno - field numbervalue - field valuepublic void unset(int fldno)
unset in class ISOComponentfldno - - the field numberpublic void unset(int... flds)
flds - - array of fields to be unset from this ISOMsgpublic void unset(java.lang.String fpath)
fpath - dot-separated field path (i.e. 63.2)public void unset(java.lang.String... fpaths)
fpaths - dot-separated field paths (i.e. 63.2)public ISOComponent getComposite()
getComposite in class ISOComponentpublic void recalcBitMap()
throws ISOException
ISOException - on errorpublic java.util.Map getChildren()
getChildren in class ISOComponentpublic byte[] pack()
throws ISOException
pack in class ISOComponentISOExceptionpublic int unpack(byte[] b)
throws ISOException
unpack in class ISOComponentb - - raw messageISOExceptionpublic void unpack(java.io.InputStream in)
throws java.io.IOException,
ISOException
unpack in class ISOComponentjava.io.IOExceptionISOExceptionpublic void dump(java.io.PrintStream p,
java.lang.String indent)
dump in interface Loggeabledump in class ISOComponentp - - print streamindent - - optional indent stringpublic ISOComponent getComponent(int fldno)
fldno - the Field Numberpublic java.lang.Object getValue(int fldno)
fldno - the Field Numberpublic java.lang.Object getValue(java.lang.String fpath)
throws ISOException
fpath - field pathISOException - on errorpublic ISOComponent getComponent(java.lang.String fpath) throws ISOException
fpath - field pathISOException - on errorpublic java.lang.String getString(int fldno)
fldno - the Field Numberpublic java.lang.String getString(java.lang.String fpath)
fpath - field pathpublic byte[] getBytes(int fldno)
fldno - the Field Numberpublic byte[] getBytes(java.lang.String fpath)
fpath - field pathpublic boolean hasField(int fldno)
fldno - the Field Numberpublic boolean hasFields(int[] fields)
fields - an array of fields to check for presencepublic boolean hasAny(int[] fields)
fields - an array of fields to check for presencepublic boolean hasAny(java.lang.String... fields)
fields - to check for presencepublic boolean hasField(java.lang.String fpath)
fpath - dot-separated field path (i.e. 63.2)public boolean hasFields()
public void setValue(java.lang.Object obj)
throws ISOException
setValue in class ISOComponentobj - ISOExceptionISOField,
ISOExceptionpublic java.lang.Object clone()
clone in class java.lang.Objectpublic java.lang.Object clone(int... fields)
fields - int array of fields to gopublic ISOMsg clone(java.lang.String... fpaths)
fpaths - string array of field paths to copypublic void merge(ISOMsg m, boolean mergeHeader)
If the input message contains a header (non-null), this method also clones the header and sets it as the header of this message.
m - The ISOMsg to merge into this ISOMsg. It must not be null.
The method does nothing if m is null.mergeHeader - A boolean flag indicating whether to merge the header of the input message into this message.public void merge(ISOMsg m)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Object getKey()
throws ISOException
ISOComponentgetKey in class ISOComponentISOExceptionpublic java.lang.Object getValue()
ISOComponentgetValue in class ISOComponentpublic boolean isInner()
public void setMTI(java.lang.String mti)
throws ISOException
mti - new MTIISOException - if message is inner messagepublic void move(int oldFieldNumber,
int newFieldNumber)
throws ISOException
oldFieldNumber - old field numbernewFieldNumber - new field numberISOException - on errorpublic int getFieldNumber()
getFieldNumber in class ISOComponentpublic boolean hasMTI()
throws ISOException
ISOException - if this is an inner messagepublic java.lang.String getMTI()
throws ISOException
ISOException - on inner message or MTI not setpublic boolean isRequest()
throws ISOException
ISOException - on MTI not setpublic boolean isResponse()
throws ISOException
ISOException - on MTI not setpublic boolean isAuthorization()
throws ISOException
ISOException - on MTI not setpublic boolean isFinancial()
throws ISOException
ISOException - on MTI not setpublic boolean isFileAction()
throws ISOException
ISOException - on MTI not setpublic boolean isReversal()
throws ISOException
ISOException - on MTI not setpublic boolean isChargeback()
throws ISOException
ISOException - on MTI not setpublic boolean isReconciliation()
throws ISOException
ISOException - on MTI not setpublic boolean isAdministrative()
throws ISOException
ISOException - on MTI not setpublic boolean isFeeCollection()
throws ISOException
ISOException - on MTI not setpublic boolean isNetworkManagement()
throws ISOException
ISOException - on MTI not setpublic boolean isRetransmission()
throws ISOException
ISOException - on MTI not setpublic void setResponseMTI()
throws ISOException
ISOException - on MTI not set or it is not a requestpublic void setRetransmissionMTI()
throws ISOException
ISOException - on MTI not set or it is not a requestprotected void writeHeader(java.io.ObjectOutput out)
throws java.io.IOException
java.io.IOExceptionprotected void readHeader(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionprotected void writePackager(java.io.ObjectOutput out)
throws java.io.IOException
java.io.IOExceptionprotected void readPackager(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionprotected void writeDirection(java.io.ObjectOutput out)
throws java.io.IOException
java.io.IOExceptionprotected void readDirection(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic void setSource(ISOSource source)
source - an ISOSourcepublic ISOSource getSource()