org.jibx.binding.def
Class NestedCollection.IndexedLoad

java.lang.Object
  extended byorg.jibx.binding.def.NestedCollection.CollectionBase
      extended byorg.jibx.binding.def.NestedCollection.CollectionLoad
          extended byorg.jibx.binding.def.NestedCollection.IndexedLoad
Enclosing class:
NestedCollection

static class NestedCollection.IndexedLoad
extends NestedCollection.CollectionLoad

Collection item load strategy for collection with items accessed by index number.


Field Summary
private  ClassItem m_getMethod
          Method used to get items by index from collection.
private  ClassItem m_sizeMethod
          Method used to get count of items in collection.
 
Constructor Summary
(package private) NestedCollection.IndexedLoad(ClassItem size, boolean doubword, ClassItem get)
          Constructor.
 
Method Summary
protected  void appendPOP(MethodBuilder mb)
          Append the appropriate instruction to pop the item value (which may be one or two words, as configured for this collection) from the top of the stack.
protected  void appendSWAP(MethodBuilder mb)
          Append the appropriate instruction to swap the top of the stack (which must be a single-word value) with an item value (which may be one or two words, as configured for this collection).
protected  void genLoadDone(ContextMethodBuilder mb)
          Generate code to clean up after loading items from collection.
protected  void genLoadInit(ContextMethodBuilder mb)
          Generate code to initialize collection for loading items.
protected  BranchWrapper genLoadItem(ContextMethodBuilder mb)
          Generate code to load next item from collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_sizeMethod

private final ClassItem m_sizeMethod
Method used to get count of items in collection.


m_getMethod

private final ClassItem m_getMethod
Method used to get items by index from collection.

Constructor Detail

NestedCollection.IndexedLoad

NestedCollection.IndexedLoad(ClassItem size,
                             boolean doubword,
                             ClassItem get)
Constructor.

Parameters:
size - method used to get count of items in collection
doubword - double word value flag
get - method used to retrieve items by index from collection
Method Detail

genLoadInit

protected void genLoadInit(ContextMethodBuilder mb)
                    throws JiBXException
Description copied from class: NestedCollection.CollectionLoad
Generate code to initialize collection for loading items. This generates the necessary code for handling the initialization. It must be called before attempting to call the NestedCollection.CollectionLoad.genLoadItem(org.jibx.binding.classes.ContextMethodBuilder) method. The base class implementation does nothing.

Overrides:
genLoadInit in class NestedCollection.CollectionLoad
Parameters:
mb - method builder
Throws:
JiBXException - if error in configuration

genLoadItem

protected BranchWrapper genLoadItem(ContextMethodBuilder mb)
                             throws JiBXException
Description copied from class: NestedCollection.CollectionLoad
Generate code to load next item from collection. This generates the necessary code for handling the load operation, leaving the item on the stack. The NestedCollection.CollectionLoad.genLoadInit(org.jibx.binding.classes.ContextMethodBuilder) method must be called before calling this method, and the NestedCollection.CollectionLoad.genLoadDone(org.jibx.binding.classes.ContextMethodBuilder) method must be called after the last call to this method. This method must be overridden by each subclass.

Specified by:
genLoadItem in class NestedCollection.CollectionLoad
Parameters:
mb - method builder
Returns:
branch wrapper for case of done with collection
Throws:
JiBXException - if error in configuration

genLoadDone

protected void genLoadDone(ContextMethodBuilder mb)
                    throws JiBXException
Description copied from class: NestedCollection.CollectionLoad
Generate code to clean up after loading items from collection. This generates the necessary code for handling the clean up. It must be called after the last call to NestedCollection.CollectionLoad.genLoadItem(org.jibx.binding.classes.ContextMethodBuilder). The base class implementation does nothing.

Overrides:
genLoadDone in class NestedCollection.CollectionLoad
Parameters:
mb - method builder
Throws:
JiBXException - if error in configuration

appendSWAP

protected void appendSWAP(MethodBuilder mb)
Append the appropriate instruction to swap the top of the stack (which must be a single-word value) with an item value (which may be one or two words, as configured for this collection).

Parameters:
mb - method

appendPOP

protected void appendPOP(MethodBuilder mb)
Append the appropriate instruction to pop the item value (which may be one or two words, as configured for this collection) from the top of the stack.

Parameters:
mb - method


Project Web Site