jPOS 1.6.7 API Documentation

org.jpos.iso
Class ISOComponent

java.lang.Object
  extended by org.jpos.iso.ISOComponent
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
ISOAmount, ISOBinaryField, ISOBitMap, ISOField, ISOMsg

public abstract class ISOComponent
extends java.lang.Object
implements java.lang.Cloneable

implements a Component within a Composite pattern See Overview for details.

Version:
$Id: ISOComponent.java 2854 2010-01-02 10:34:31Z apr $
Author:
apr@cs.com.uy
See Also:
ISOMsg, ISOField, ISOException

Constructor Summary
ISOComponent()
           
 
Method Summary
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 0 elements Hashtable
 ISOComponent getComposite()
          In order to interchange Composites and Leafs we use getComposite().
 java.lang.Object getKey()
          valid on Leafs only.
 int getMaxField()
          a Composite must override this function
 java.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 message
abstract  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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 0 elements Hashtable

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

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

jPOS.org