Class ISOMsgRef.Ref
java.lang.Object
org.jpos.iso.ISOComponent
org.jpos.iso.ISOMsg
org.jpos.tlv.ISOMsgRef.Ref
- All Implemented Interfaces:
Externalizable, Serializable, Cloneable, OffsetIndexedComposite, Loggeable
- Enclosing class:
ISOMsgRef
Inner class providing offset-indexed access to a referenced ISO message.
- See Also:
-
Field Summary
Fields inherited from class ISOMsg
direction, dirty, fields, header, INCOMING, maxField, maxFieldDirty, OUTGOING, packager, trailerModifier and TypeFieldDescriptionprotected intMessage direction: INCOMING or OUTGOING.protected booleanDirty flags for tracking state changes.Map of field number to field value.protected ISOHeaderOptional ISO header for this message.static final intConstant indicating an incoming message direction.protected intHighest field number currently set in this message.protected booleanDirty flags for tracking state changes.static final intConstant indicating an outgoing message direction.protected ISOPackagerThe packager used to pack/unpack this message.protected byte[]Optional trailer bytes appended to the packed message. -
Method Summary
Modifier and TypeMethodDescriptionclone()clone(int[] fields) Partially clone an ISOMsgvoiddump(PrintStream p, 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[]Return the String value associated with the given field pathclone fieldsgetComponent(int fldno) get the component associated with the given field numbergetComponent(String fpath) get the component associated with the given field numberIn order to interchange Composites and Leafs we use getComposite().intReturns the message direction.byte[]get optional message header imageReturn this messages ISOHeadergetKey()valid on Leafs only.intReturns the highest field number present in this message.getMTI()Returns the message type indicator.intReturns the current offset.Returns the packager associated with this message.getString(int fldno) Return the String value associated with the given ISOField numberReturn the String value associated with the given field pathgetValue()Returns this message itself as its value.getValue(int fldno) Return the object value associated with the given field numberReturn the object value associated with the given field pathbooleanhasField(int fldno) Check if a given field is presentbooleanCheck if a field indicated by a fpath is presentbooleanReturns true if this message has at least one field set.booleanhasFields(int[] fields) Check if all fields are presentvoidIncrements the current offset by one.booleanReturns true if this message was received from a channel.booleanisInner()Returns true if this is an inner (sub-) message.booleanReturns true if this message is to be sent via a channel.booleanReturns true if the MTI suggests this is a request message.voidMerges the content of the specified ISOMsg into this ISOMsg instance, excluding the header.voidmove(int oldFieldNumber, int newFieldNumber) moves a field (renumber)byte[]pack()Packs this message using the configured packager.voidpack(OutputStream out) Packs this component and writes it toout.voidsetup BitMapvoidResets the offset to its initial value.voidset(int fldno, byte[] value) Creates an ISOBinaryField associated with fldno within this ISOMsg.voidCreates an ISOField associated with fldno within this ISOMsg.voidCreates an ISOField associated with fldno within this ISOMsg.voidCreates an ISOField associated with fldno within this ISOMsg.voidset(String fpath, ISOComponent c) Creates an ISOField associated with fldno within this ISOMsgvoidset(ISOComponent c) Set a field within this messagevoidsetDirection(int direction) Sets the direction information related to this messagevoidsetFieldNumber(int fieldNumber) changes this Component field number
Use with care, this method does not change any reference held by a Composite.voidsetHeader(byte[] b) Sets an optional message header imagevoidSets the ISO header for this message.voidSets the message type indicator.voidsetOffset(int offset) Sets the current offset.voidSets the packager used to pack/unpack this message.voidDon't call setValue on an ISOMsg.toString()intunpack(byte[] b) Unpacks the raw byte array into this message.voidunpack(InputStream in) Unpacks this component by reading fromin.voidunset(int fldno) Unset a field if it exists, otherwise ignore.voidunset(int[] flds) Unsets several fields at oncevoidUnset a field referenced by a fpath if it exists, otherwise ignore.Methods inherited from class ISOMsg
clone, getFieldNumber, getSource, getTrailer, hasAny, hasAny, hasMTI, isAdministrative, isAuthorization, isChargeback, isFeeCollection, isFileAction, isFinancial, isNetworkManagement, isReconciliation, isResponse, isRetransmission, isReversal, merge, readDirection, readExternal, readHeader, readPackager, setResponseMTI, setRetransmissionMTI, setSource, setTrailer, unset, with, with, with, with, with, without, without, writeDirection, writeExternal, writeHeader, writePackagerModifier and TypeMethodDescriptionPartially clone an ISOMsg by field pathsintReturns the field number this component occupies within its container.Returns the associated ISOSource (e.g.byte[]Get optional trailer image.booleanhasAny(int[] fields) Check if the message has any of these fieldsbooleanCheck if the message has any of these fieldsbooleanhasMTI()Returns true if this message has an MTI field (field 0) set.booleanReturns true if this is an administrative message (MTI second digit = 6).booleanReturns true if this is an authorization message (MTI second digit = 1).booleanReturns true if this is a chargeback message (MTI second digit = 4, last digit 2 or 3).booleanReturns true if this is a fee collection message (MTI second digit = 7).booleanReturns true if this is a file action message (MTI second digit = 3).booleanReturns true if this is a financial message (MTI second digit = 2).booleanReturns true if this is a network management message (MTI second digit = 8).booleanReturns true if this is a reconciliation message (MTI second digit = 5).booleanReturns true if the MTI suggests this is a response message.booleanReturns true if this is a retransmission (MTI last digit = 1).booleanReturns true if this is a reversal message (MTI second digit = 4, last digit 0 or 1).voidMerges the content of the specified ISOMsg into this ISOMsg instance.protected voidDeserializes the message direction from the given ObjectInput.voidprotected voidDeserializes the message header from the given ObjectInput.protected voidDeserializes the packager from the given ObjectInput.voidsets an appropriate response MTI.voidsets an appropriate retransmission MTIvoidLet this ISOMsg object hold a weak reference to an ISOSource (usually used to carry a reference to the incoming ISOChannel)voidsetTrailer(byte[] trailer) Sets optional trailer data.voidUnset a a set of fields referenced by fpaths if any ot them exist, otherwise ignore.with(int fldno, byte[] value) Sets a top-level binary field and returns this message for fluent chaining.Sets a top-level character field and returns this message for fluent chaining.Sets a binary field by path and returns this message for fluent chaining.Sets a character field by path and returns this message for fluent chaining.with(String fpath, ISOComponent c) Sets a component by path and returns this message for fluent chaining.without(int... flds) Unsets one or more top-level fields and returns this message for fluent chaining.Unsets one or more field paths, including nested composites and dataset elements, and returns this message for fluent chaining.protected voidSerializes the message direction to the given ObjectOutput.voidprotected voidwriteHeader(ObjectOutput out) Serializes the message header to the given ObjectOutput.protected voidSerializes the packager class name to the given ObjectOutput.Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Loggeable
dumpModifier and TypeMethodDescriptiondefault voiddump(PrintStream p, String indent, LogRenderer.Type type) Dumps a representation of this object using the specified renderer type.
-
Method Details
-
incOffset
Description copied from interface:OffsetIndexedCompositeIncrements the current offset by one.- Specified by:
incOffsetin interfaceOffsetIndexedComposite
-
setOffset
Description copied from interface:OffsetIndexedCompositeSets the current offset.- Specified by:
setOffsetin interfaceOffsetIndexedComposite- Parameters:
offset- the new offset value
-
resetOffset
Description copied from interface:OffsetIndexedCompositeResets the offset to its initial value.- Specified by:
resetOffsetin interfaceOffsetIndexedComposite
-
getOffset
Description copied from interface:OffsetIndexedCompositeReturns the current offset.- Specified by:
getOffsetin interfaceOffsetIndexedComposite- Returns:
- the current offset
-
getKey
Description copied from class:ISOComponentvalid on Leafs only. The value returned is used by ISOMsg as a key to this field.- Overrides:
getKeyin classISOMsg- Returns:
- object representing the field number
- Throws:
ISOException- thrown by composites; leaves return their key
-
setFieldNumber
Description copied from class:ISOMsgchanges this Component field number
Use with care, this method does not change any reference held by a Composite.- Overrides:
setFieldNumberin classISOMsg- Parameters:
fieldNumber- new field number
-
setValue
Description copied from class:ISOMsgDon't call setValue on an ISOMsg. You'll sure get an ISOException. It's intended to be used on Leafs- Overrides:
setValuein classISOMsg- Parameters:
obj- value to set (not supported on ISOMsg)- Throws:
ISOException- always- See Also:
-
set
Description copied from class:ISOMsgSet a field within this message- Overrides:
setin classISOMsg- Parameters:
c- - a component- Throws:
ISOException- always thrown by leaves; composites override this
-
unset
-
getComposite
Description copied from class:ISOMsgIn order to interchange Composites and Leafs we use getComposite(). A Composite component returns itself and a Leaf returns null.- Overrides:
getCompositein classISOMsg- Returns:
- ISOComponent
-
getValue
-
getBytes
Description copied from class:ISOComponentget Value as bytes (when possible)- Overrides:
getBytesin classISOComponent- Returns:
- byte[] representing this field
- Throws:
ISOException- thrown by composites or when the value cannot be rendered as bytes
-
getMaxField
Description copied from class:ISOMsgReturns the highest field number present in this message.- Overrides:
getMaxFieldin classISOMsg- Returns:
- the max field number
-
getChildren
Description copied from class:ISOMsgclone fields- Overrides:
getChildrenin classISOMsg- Returns:
- copy of fields
-
pack
Description copied from class:ISOComponentPacks this component and writes it toout.- Overrides:
packin classISOComponent- Parameters:
out- destination stream- Throws:
IOException- if writing failsISOException- if packing fails
-
dump
Description copied from class:ISOMsgdump 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
Description copied from class:ISOMsgPacks this message using the configured packager.- Overrides:
packin classISOMsg- Returns:
- the packed message
- Throws:
ISOException- on packing error
-
unpack
Description copied from class:ISOMsgUnpacks the raw byte array into this message.- Overrides:
unpackin classISOMsg- Parameters:
b- - raw message- Returns:
- consumed bytes
- Throws:
ISOException- on unpacking error
-
unpack
Description copied from class:ISOMsgUnpacks this component by reading fromin.- Overrides:
unpackin classISOMsg- Parameters:
in- source stream- Throws:
IOException- on I/O failureISOException- on unpacking error
-
setDirection
Description copied from class:ISOMsgSets the direction information related to this message- Overrides:
setDirectionin classISOMsg- Parameters:
direction- can be either ISOMsg.INCOMING or ISOMsg.OUTGOING
-
setHeader
-
setHeader
-
getHeader
-
getISOHeader
Description copied from class:ISOMsgReturn this messages ISOHeader- Overrides:
getISOHeaderin classISOMsg- Returns:
- header associated with this ISOMsg, can be null
-
getDirection
Description copied from class:ISOMsgReturns the message direction.- Overrides:
getDirectionin classISOMsg- Returns:
- the direction (
ISOMsg.INCOMINGorISOMsg.OUTGOING) - See Also:
-
isIncoming
Description copied from class:ISOMsgReturns true if this message was received from a channel.- Overrides:
isIncomingin classISOMsg- Returns:
- true if this is an incoming message
- See Also:
-
isOutgoing
Description copied from class:ISOMsgReturns true if this message is to be sent via a channel.- Overrides:
isOutgoingin classISOMsg- Returns:
- true if this is an outgoing message
- See Also:
-
setPackager
Description copied from class:ISOMsgSets the packager used to pack/unpack this message.- Overrides:
setPackagerin classISOMsg- Parameters:
p- - a peer packager
-
getPackager
Description copied from class:ISOMsgReturns the packager associated with this message.- Overrides:
getPackagerin classISOMsg- Returns:
- the peer packager
-
set
-
set
-
set
Description copied from class:ISOMsgCreates an ISOField associated with fldno within this ISOMsg- Overrides:
setin classISOMsg- Parameters:
fpath- dot-separated field path (i.e. 63.2)c- component- Throws:
ISOException- on error
-
set
-
set
-
unset
-
unset
-
recalcBitMap
Description copied from class:ISOMsgsetup BitMap- Overrides:
recalcBitMapin classISOMsg- Throws:
ISOException- on error
-
getComponent
Description copied from class:ISOMsgget the component associated with the given field number- Overrides:
getComponentin classISOMsg- Parameters:
fldno- the Field Number- Returns:
- the Component
-
getValue
-
getValue
Description copied from class:ISOMsgReturn the object value associated with the given field path- Overrides:
getValuein classISOMsg- Parameters:
fpath- field path- Returns:
- the field Object (may be null)
- Throws:
ISOException- on error
-
getComponent
Description copied from class:ISOMsgget the component associated with the given field number- Overrides:
getComponentin classISOMsg- Parameters:
fpath- field path- Returns:
- the Component
- Throws:
ISOException- on error
-
getString
-
getString
-
getBytes
Description copied from class:ISOMsgReturn the byte[] value associated with the given ISOField number -
getBytes
-
hasField
-
hasFields
-
hasField
-
hasFields
-
clone
-
clone
-
merge
Description copied from class:ISOMsgMerges the content of the specified ISOMsg into this ISOMsg instance, excluding the header. This method is a convenience wrapper aroundISOMsg.merge(ISOMsg, boolean)with themergeHeaderparameter set tofalsefor backward compatibility, indicating that the header of the input message will not be merged. -
toString
-
isInner
-
setMTI
Description copied from class:ISOMsgSets the message type indicator.- Overrides:
setMTIin classISOMsg- Parameters:
mti- new MTI- Throws:
ISOException- if message is inner message
-
move
Description copied from class:ISOMsgmoves a field (renumber)- Overrides:
movein classISOMsg- Parameters:
oldFieldNumber- old field numbernewFieldNumber- new field number- Throws:
ISOException- on error
-
getMTI
Description copied from class:ISOMsgReturns the message type indicator.- Overrides:
getMTIin classISOMsg- Returns:
- current MTI
- Throws:
ISOException- on inner message or MTI not set
-
isRequest
Description copied from class:ISOMsgReturns true if the MTI suggests this is a request message.- Overrides:
isRequestin classISOMsg- Returns:
- true if message "seems to be" a request
- Throws:
ISOException- on MTI not set
-