org.jpos.iso
Class ISOComponent

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

public abstract class ISOComponent
extends Object
implements Cloneable

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

Version:
$Id$
Author:
apr@cs.com.uy
See Also:
ISOMsg, ISOField, ISOException

Constructor Summary
ISOComponent()
           
 
Method Summary
abstract  void dump(PrintStream p, String indent)
           
 byte[] getBytes()
          get Value as bytes (when possible)
 Map getChildren()
          dummy behaviour - return 0 elements Hashtable
 ISOComponent getComposite()
          In order to interchange Composites and Leafs we use getComposite().
 Object getKey()
          valid on Leafs only.
 int getMaxField()
          a Composite must override this function
 Object getValue()
          valid on Leafs only.
abstract  byte[] pack()
           
 void pack(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(Object obj)
           
abstract  int unpack(byte[] b)
           
abstract  void unpack(InputStream in)
           
 void unset(int fldno)
          Unset a field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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 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 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 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(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(PrintStream p,
                          String indent)

pack

public void pack(OutputStream out)
          throws IOException,
                 ISOException
Throws:
IOException
ISOException

unpack

public abstract void unpack(InputStream in)
                     throws IOException,
                            ISOException
Throws:
IOException
ISOException


Copyright © 1998-2012 jPOS.org. All Rights Reserved.