|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cb2java.copybook.Element
base class for types represented in the copybook
Constructor Summary | |
protected |
Element(java.lang.String name,
int level,
int occurs)
constructor |
Method Summary | |
byte[] |
getBytes(java.lang.String s)
converts a String to a byte array based on the current encoding |
abstract java.util.List |
getChildren()
gets the children of this element or null if there are none |
protected abstract int |
getLength()
returns the length of one instance of this element |
int |
getLevel()
returns the level of this element |
java.lang.String |
getName()
returns the name of this element |
int |
getOccurs()
returns the number of times this item appears in data |
int |
getPosition()
returns the position of this element |
java.lang.String |
getString(byte[] data)
helper method for converting the given bytes to a string with the parent copybook's encoding |
protected abstract Value |
getValue()
the value for this element |
abstract byte[] |
toBytes(java.lang.Object data)
converts the supplied data to bytes |
java.lang.String |
toString()
|
abstract void |
validate(java.lang.Object data)
validates the data based on this element definition |
void |
write(java.io.OutputStream stream,
java.lang.Object data)
writes the data as bytes to the given stream |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected Element(java.lang.String name, int level, int occurs)
name
- the element namelevel
- the level of the elementoccurs
- how many times the element occursMethod Detail |
protected abstract Value getValue()
public abstract java.util.List getChildren()
protected abstract int getLength()
public abstract void validate(java.lang.Object data) throws java.lang.IllegalArgumentException
data
- the data to validate
java.lang.IllegalArgumentException
- if the data is invalidpublic abstract byte[] toBytes(java.lang.Object data)
data
- the data to convert to bytes
public final java.lang.String getName()
public final int getLevel()
public final int getPosition()
public int getOccurs()
public final void write(java.io.OutputStream stream, java.lang.Object data) throws java.io.IOException
stream
- the outputstreamdata
- the data to write as bytes
java.io.IOException
public final java.lang.String getString(byte[] data)
data
- the data to convert to a String
public final byte[] getBytes(java.lang.String s)
s
-
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |