Package org.jpos.iso
Class ISOComponent
- java.lang.Object
-
- org.jpos.iso.ISOComponent
-
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
ISOAmount
,ISOBinaryField
,ISOBitMap
,ISOField
,ISOMsg
,ISOTaggedField
public abstract class ISOComponent extends java.lang.Object implements java.lang.Cloneable
implements a Component within a Composite pattern See Overview for details.- See Also:
ISOMsg
,ISOField
,ISOException
-
-
Constructor Summary
Constructors Constructor Description ISOComponent()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
dump(java.io.PrintStream p, java.lang.String indent)
byte[]
getBytes()
get Value as bytes (when possible)java.util.Map
getChildren()
dummy behaviour - return empty mapISOComponent
getComposite()
In order to interchange Composites and Leafs we use getComposite().abstract int
getFieldNumber()
java.lang.Object
getKey()
valid on Leafs only.int
getMaxField()
a Composite must override this functionjava.lang.Object
getValue()
valid on Leafs only.abstract byte[]
pack()
void
pack(java.io.OutputStream out)
void
set(ISOComponent c)
Set a field within this messageabstract void
setFieldNumber(int fieldNumber)
changes this Component field number
Use with care, this method does not change any reference held by a Composite.abstract void
setValue(java.lang.Object obj)
abstract int
unpack(byte[] b)
abstract void
unpack(java.io.InputStream in)
void
unset(int fldno)
Unset a field
-
-
-
Constructor Detail
-
ISOComponent
public ISOComponent()
-
-
Method Detail
-
set
public void set(ISOComponent c) throws ISOException
Set a field within this message- Parameters:
c
- - a component- Throws:
ISOException
-
unset
public void unset(int fldno) throws ISOException
Unset a field- Parameters:
fldno
- - the field number- Throws:
ISOException
-
getComposite
public ISOComponent getComposite()
In order to interchange Composites and Leafs we use getComposite(). A Composite component returns itself and a Leaf returns null. The base class ISOComponent provides Leaf functionality.- Returns:
- ISOComponent
-
getKey
public java.lang.Object getKey() throws ISOException
valid on Leafs only. The value returned is used by ISOMsg as a key to this field.- Returns:
- object representing the field number
- Throws:
ISOException
-
getValue
public java.lang.Object getValue() throws ISOException
valid on Leafs only.- Returns:
- object representing the field value
- Throws:
ISOException
-
getBytes
public byte[] getBytes() throws ISOException
get Value as bytes (when possible)- Returns:
- byte[] representing this field
- Throws:
ISOException
-
getMaxField
public int getMaxField()
a Composite must override this function- Returns:
- the max field number associated with this message
-
getChildren
public java.util.Map getChildren()
dummy behaviour - return empty map- Returns:
- children (in this case 0 children)
-
setFieldNumber
public abstract void setFieldNumber(int fieldNumber)
changes this Component field number
Use with care, this method does not change any reference held by a Composite.- Parameters:
fieldNumber
- new field number
-
getFieldNumber
public abstract int getFieldNumber()
-
setValue
public abstract void setValue(java.lang.Object obj) throws ISOException
- Throws:
ISOException
-
pack
public abstract byte[] pack() throws ISOException
- Throws:
ISOException
-
unpack
public abstract int unpack(byte[] b) throws ISOException
- Throws:
ISOException
-
dump
public abstract void dump(java.io.PrintStream p, java.lang.String indent)
-
pack
public void pack(java.io.OutputStream out) throws java.io.IOException, ISOException
- Throws:
java.io.IOException
ISOException
-
unpack
public abstract void unpack(java.io.InputStream in) throws java.io.IOException, ISOException
- Throws:
java.io.IOException
ISOException
-
-