Package org.jpos.tlv
Class ISOMsgRef.Ref
- java.lang.Object
-
- org.jpos.iso.ISOComponent
-
- org.jpos.iso.ISOMsg
-
- org.jpos.tlv.ISOMsgRef.Ref
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,java.lang.Cloneable
,OffsetIndexedComposite
,Loggeable
- Enclosing class:
- ISOMsgRef
public class ISOMsgRef.Ref extends ISOMsg implements OffsetIndexedComposite
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
java.lang.Object
clone(int[] fields)
Partially clone an ISOMsgvoid
dump(java.io.PrintStream p, java.lang.String indent)
dump the message to a PrintStream.byte[]
getBytes()
get Value as bytes (when possible)byte[]
getBytes(int fldno)
Return the byte[] value associated with the given ISOField numberbyte[]
getBytes(java.lang.String fpath)
Return the String value associated with the given field pathjava.util.Map
getChildren()
clone fieldsISOComponent
getComponent(int fldno)
get the component associated with the given field numberISOComponent
getComponent(java.lang.String fpath)
get the component associated with the given field numberISOComponent
getComposite()
In order to interchange Composites and Leafs we use getComposite().int
getDirection()
byte[]
getHeader()
get optional message header imageISOHeader
getISOHeader()
Return this messages ISOHeaderjava.lang.Object
getKey()
valid on Leafs only.int
getMaxField()
a Composite must override this functionjava.lang.String
getMTI()
int
getOffset()
ISOPackager
getPackager()
java.lang.String
getString(int fldno)
Return the String value associated with the given ISOField numberjava.lang.String
getString(java.lang.String fpath)
Return the String value associated with the given field pathjava.lang.Object
getValue()
valid on Leafs only.java.lang.Object
getValue(int fldno)
Return the object value associated with the given field numberjava.lang.Object
getValue(java.lang.String fpath)
Return the object value associated with the given field pathboolean
hasField(int fldno)
Check if a given field is presentboolean
hasField(java.lang.String fpath)
Check if a field indicated by a fpath is presentboolean
hasFields()
boolean
hasFields(int[] fields)
Check if all fields are presentvoid
incOffset()
boolean
isIncoming()
boolean
isInner()
boolean
isOutgoing()
boolean
isRequest()
void
merge(ISOMsg m)
add all fields present on received parameter to this ISOMsg
please note that received fields take precedence over existing ones (simplifying card agent message creation and template handling)void
move(int oldFieldNumber, int newFieldNumber)
moves a field (renumber)byte[]
pack()
pack the message with the current packagervoid
pack(java.io.OutputStream out)
void
recalcBitMap()
setup BitMapvoid
resetOffset()
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(java.lang.String fpath, byte[] value)
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
set(java.lang.String fpath, ISOComponent c)
Creates an ISOField associated with fldno within this ISOMsgvoid
set(ISOComponent c)
Set a field within this messagevoid
setDirection(int direction)
Sets the direction information related to this messagevoid
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 imagevoid
setHeader(ISOHeader header)
void
setMTI(java.lang.String mti)
void
setOffset(int offset)
void
setPackager(ISOPackager p)
void
setValue(java.lang.Object obj)
Don't call setValue on an ISOMsg.java.lang.String
toString()
int
unpack(byte[] b)
unpack a messagevoid
unpack(java.io.InputStream in)
void
unset(int fldno)
Unset a field if it exists, otherwise ignore.void
unset(int[] flds)
Unsets several fields at oncevoid
unset(java.lang.String fpath)
Unset a field referenced by a fpath if it exists, otherwise ignore.-
Methods inherited from class org.jpos.iso.ISOMsg
clone, getFieldNumber, getSource, getTrailer, hasAny, hasAny, hasMTI, isAdministrative, isAuthorization, isChargeback, isFeeCollection, isFileAction, isFinancial, isNetworkManagement, isReconciliation, isResponse, isRetransmission, isReversal, readDirection, readExternal, readHeader, readPackager, setResponseMTI, setRetransmissionMTI, setSource, setTrailer, unset, writeDirection, writeExternal, writeHeader, writePackager
-
-
-
-
Method Detail
-
incOffset
public void incOffset()
- Specified by:
incOffset
in interfaceOffsetIndexedComposite
-
setOffset
public void setOffset(int offset)
- Specified by:
setOffset
in interfaceOffsetIndexedComposite
-
resetOffset
public void resetOffset()
- Specified by:
resetOffset
in interfaceOffsetIndexedComposite
-
getOffset
public int getOffset()
- Specified by:
getOffset
in interfaceOffsetIndexedComposite
-
getKey
public java.lang.Object getKey() throws ISOException
Description copied from class:ISOComponent
valid on Leafs only. The value returned is used by ISOMsg as a key to this field.- Overrides:
getKey
in classISOMsg
- Returns:
- object representing the field number
- Throws:
ISOException
-
setFieldNumber
public void setFieldNumber(int fieldNumber)
Description copied from class:ISOMsg
changes this Component field number
Use with care, this method does not change any reference held by a Composite.- Overrides:
setFieldNumber
in classISOMsg
- Parameters:
fieldNumber
- new field number
-
setValue
public void setValue(java.lang.Object obj) throws ISOException
Description copied from class:ISOMsg
Don't call setValue on an ISOMsg. You'll sure get an ISOException. It's intended to be used on Leafs- Overrides:
setValue
in classISOMsg
- Throws:
ISOException
- See Also:
ISOField
,ISOException
-
set
public void set(ISOComponent c) throws ISOException
Description copied from class:ISOMsg
Set a field within this message- Overrides:
set
in classISOMsg
- Parameters:
c
- - a component- Throws:
ISOException
-
unset
public void unset(int fldno)
Description copied from class:ISOMsg
Unset a field if it exists, otherwise ignore.
-
getComposite
public ISOComponent getComposite()
Description copied from class:ISOMsg
In order to interchange Composites and Leafs we use getComposite(). A Composite component returns itself and a Leaf returns null.- Overrides:
getComposite
in classISOMsg
- Returns:
- ISOComponent
-
getValue
public java.lang.Object getValue()
Description copied from class:ISOComponent
valid on Leafs only.
-
getBytes
public byte[] getBytes() throws ISOException
Description copied from class:ISOComponent
get Value as bytes (when possible)- Overrides:
getBytes
in classISOComponent
- Returns:
- byte[] representing this field
- Throws:
ISOException
-
getMaxField
public int getMaxField()
Description copied from class:ISOComponent
a Composite must override this function- Overrides:
getMaxField
in classISOMsg
- Returns:
- the max field number associated with this message
-
getChildren
public java.util.Map getChildren()
Description copied from class:ISOMsg
clone fields- Overrides:
getChildren
in classISOMsg
- Returns:
- copy of fields
-
pack
public void pack(java.io.OutputStream out) throws java.io.IOException, ISOException
- Overrides:
pack
in classISOComponent
- Throws:
java.io.IOException
ISOException
-
dump
public void dump(java.io.PrintStream p, java.lang.String indent)
Description copied from class:ISOMsg
dump the message to a PrintStream. The output is sorta XML, intended to be easily parsed.
Each component is responsible for its own dump function, ISOMsg just calls dump on every valid field.
-
pack
public byte[] pack() throws ISOException
Description copied from class:ISOMsg
pack the message with the current packager- Overrides:
pack
in classISOMsg
- Returns:
- the packed message
- Throws:
ISOException
-
unpack
public int unpack(byte[] b) throws ISOException
Description copied from class:ISOMsg
unpack a message- Overrides:
unpack
in classISOMsg
- Parameters:
b
- - raw message- Returns:
- consumed bytes
- Throws:
ISOException
-
unpack
public void unpack(java.io.InputStream in) throws java.io.IOException, ISOException
- Overrides:
unpack
in classISOMsg
- Throws:
java.io.IOException
ISOException
-
setDirection
public void setDirection(int direction)
Description copied from class:ISOMsg
Sets the direction information related to this message- Overrides:
setDirection
in classISOMsg
- Parameters:
direction
- can be either ISOMsg.INCOMING or ISOMsg.OUTGOING
-
setHeader
public void setHeader(byte[] b)
Description copied from class:ISOMsg
Sets an optional message header image
-
getHeader
public byte[] getHeader()
Description copied from class:ISOMsg
get optional message header image
-
getISOHeader
public ISOHeader getISOHeader()
Description copied from class:ISOMsg
Return this messages ISOHeader- Overrides:
getISOHeader
in classISOMsg
- Returns:
- header associated with this ISOMsg, can be null
-
getDirection
public int getDirection()
- Overrides:
getDirection
in classISOMsg
- Returns:
- the direction (ISOMsg.INCOMING or ISOMsg.OUTGOING)
- See Also:
ISOChannel
-
isIncoming
public boolean isIncoming()
- Overrides:
isIncoming
in classISOMsg
- Returns:
- true if this message is an incoming message
- See Also:
ISOChannel
-
isOutgoing
public boolean isOutgoing()
- Overrides:
isOutgoing
in classISOMsg
- Returns:
- true if this message is an outgoing message
- See Also:
ISOChannel
-
setPackager
public void setPackager(ISOPackager p)
- Overrides:
setPackager
in classISOMsg
- Parameters:
p
- - a peer packager
-
getPackager
public ISOPackager getPackager()
- Overrides:
getPackager
in classISOMsg
- Returns:
- the peer packager
-
set
public void set(int fldno, java.lang.String value)
Description copied from class:ISOMsg
Creates an ISOField associated with fldno within this ISOMsg.
-
set
public void set(java.lang.String fpath, java.lang.String value)
Description copied from class:ISOMsg
Creates an ISOField associated with fldno within this ISOMsg.
-
set
public void set(java.lang.String fpath, ISOComponent c) throws ISOException
Description copied from class:ISOMsg
Creates an ISOField associated with fldno within this ISOMsg- Overrides:
set
in classISOMsg
- Parameters:
fpath
- dot-separated field path (i.e. 63.2)c
- component- Throws:
ISOException
- on error
-
set
public void set(java.lang.String fpath, byte[] value)
Description copied from class:ISOMsg
Creates an ISOField associated with fldno within this ISOMsg.
-
set
public void set(int fldno, byte[] value)
Description copied from class:ISOMsg
Creates an ISOBinaryField associated with fldno within this ISOMsg.
-
unset
public void unset(int[] flds)
Description copied from class:ISOMsg
Unsets several fields at once
-
unset
public void unset(java.lang.String fpath)
Description copied from class:ISOMsg
Unset a field referenced by a fpath if it exists, otherwise ignore.
-
recalcBitMap
public void recalcBitMap() throws ISOException
Description copied from class:ISOMsg
setup BitMap- Overrides:
recalcBitMap
in classISOMsg
- Throws:
ISOException
- on error
-
getComponent
public ISOComponent getComponent(int fldno)
Description copied from class:ISOMsg
get the component associated with the given field number- Overrides:
getComponent
in classISOMsg
- Parameters:
fldno
- the Field Number- Returns:
- the Component
-
getValue
public java.lang.Object getValue(int fldno)
Description copied from class:ISOMsg
Return the object value associated with the given field number
-
getValue
public java.lang.Object getValue(java.lang.String fpath) throws ISOException
Description copied from class:ISOMsg
Return the object value associated with the given field path- Overrides:
getValue
in classISOMsg
- Parameters:
fpath
- field path- Returns:
- the field Object (may be null)
- Throws:
ISOException
- on error
-
getComponent
public ISOComponent getComponent(java.lang.String fpath) throws ISOException
Description copied from class:ISOMsg
get the component associated with the given field number- Overrides:
getComponent
in classISOMsg
- Parameters:
fpath
- field path- Returns:
- the Component
- Throws:
ISOException
- on error
-
getString
public java.lang.String getString(int fldno)
Description copied from class:ISOMsg
Return the String value associated with the given ISOField number
-
getString
public java.lang.String getString(java.lang.String fpath)
Description copied from class:ISOMsg
Return the String value associated with the given field path
-
getBytes
public byte[] getBytes(int fldno)
Description copied from class:ISOMsg
Return the byte[] value associated with the given ISOField number
-
getBytes
public byte[] getBytes(java.lang.String fpath)
Description copied from class:ISOMsg
Return the String value associated with the given field path
-
hasField
public boolean hasField(int fldno)
Description copied from class:ISOMsg
Check if a given field is present
-
hasFields
public boolean hasFields(int[] fields)
Description copied from class:ISOMsg
Check if all fields are present
-
hasField
public boolean hasField(java.lang.String fpath)
Description copied from class:ISOMsg
Check if a field indicated by a fpath is present
-
hasFields
public boolean hasFields()
-
clone
public java.lang.Object clone(int[] fields)
Description copied from class:ISOMsg
Partially clone an ISOMsg
-
merge
public void merge(ISOMsg m)
Description copied from class:ISOMsg
add all fields present on received parameter to this ISOMsg
please note that received fields take precedence over existing ones (simplifying card agent message creation and template handling)
-
toString
public java.lang.String toString()
-
setMTI
public void setMTI(java.lang.String mti) throws ISOException
- Overrides:
setMTI
in classISOMsg
- Parameters:
mti
- new MTI- Throws:
ISOException
- if message is inner message
-
move
public void move(int oldFieldNumber, int newFieldNumber) throws ISOException
Description copied from class:ISOMsg
moves a field (renumber)- Overrides:
move
in classISOMsg
- Parameters:
oldFieldNumber
- old field numbernewFieldNumber
- new field number- Throws:
ISOException
- on error
-
getMTI
public java.lang.String getMTI() throws ISOException
- Overrides:
getMTI
in classISOMsg
- Returns:
- current MTI
- Throws:
ISOException
- on inner message or MTI not set
-
isRequest
public boolean isRequest() throws ISOException
- Overrides:
isRequest
in classISOMsg
- Returns:
- true if message "seems to be" a request
- Throws:
ISOException
- on MTI not set
-
-