org.glassfish.grizzly.smart.transformers
Class ArrayDecoder

java.lang.Object
  extended by org.glassfish.grizzly.AbstractTransformer<Buffer,E>
      extended by org.glassfish.grizzly.smart.transformers.AbstractSmartMemberDecoder<E>
          extended by org.glassfish.grizzly.smart.transformers.SequenceDecoder<Object>
              extended by org.glassfish.grizzly.smart.transformers.ArrayDecoder
All Implemented Interfaces:
SmartMemberTransformer<Buffer,Object>, Transformer<Buffer,Object>

public class ArrayDecoder
extends SequenceDecoder<Object>

Author:
oleksiys

Field Summary
protected  Attribute<Integer> currentElementIdxAttribute
           
 
Fields inherited from class org.glassfish.grizzly.smart.transformers.SequenceDecoder
componentDecoder, componentType, config, sequenceAttribute
 
Fields inherited from class org.glassfish.grizzly.smart.transformers.AbstractSmartMemberDecoder
messageProcessingTreeAttribute
 
Fields inherited from class org.glassfish.grizzly.AbstractTransformer
attributeBuilder, incompletedResult, inputBufferAttribute, lastResultAttribute, outputBufferAttribute
 
Constructor Summary
ArrayDecoder()
           
 
Method Summary
protected  Object createSequence(AttributeStorage storage, int size)
          Creates a sequence object with certain size.
protected  boolean next(AttributeStorage storage, Object sequence)
          Moves to next sequence element and makes it current.
 void release(AttributeStorage storage)
          The Transformer has done its work and can release all associated resource.
protected  void set(AttributeStorage storage, Object sequence, Object component)
          Stores an element into the sequence.
protected  int size(AttributeStorage storage, Object sequence)
          Returns the size of the sequence.
 TransformationResult<Object> transform(AttributeStorage storage, Buffer input, Object output)
          Transforms an input data to some custom representation.
 
Methods inherited from class org.glassfish.grizzly.smart.transformers.SequenceDecoder
checkSize, getAnnotatedLimit, getAnnotatedSize, getComponentDecoder, getComponentType, getConfig, getSequence, initialize, saveState, setComponentDecoder, setComponentType, setConfig
 
Methods inherited from class org.glassfish.grizzly.smart.transformers.AbstractSmartMemberDecoder
getCurrentMessageProcessingObject, getMessageProcessingTree
 
Methods inherited from class org.glassfish.grizzly.AbstractTransformer
getInput, getLastResult, getMemoryManager, getOutput, getProperties, getValue, getValue, hibernate, obtainMemoryManager, removeValue, setInput, setMemoryManager, setOutput, setValue, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.glassfish.grizzly.Transformer
getInput, getLastResult, getOutput, getProperties, hibernate, setInput, setOutput, transform
 

Field Detail

currentElementIdxAttribute

protected Attribute<Integer> currentElementIdxAttribute
Constructor Detail

ArrayDecoder

public ArrayDecoder()
Method Detail

transform

public TransformationResult<Object> transform(AttributeStorage storage,
                                              Buffer input,
                                              Object output)
                                       throws TransformationException
Description copied from interface: Transformer
Transforms an input data to some custom representation.

Specified by:
transform in interface Transformer<Buffer,Object>
Overrides:
transform in class SequenceDecoder<Object>
Parameters:
storage - the external state storage, where Transformer could retrieve or store its state.
Returns:
the result TransformationResult
Throws:
TransformationException

release

public void release(AttributeStorage storage)
Description copied from interface: Transformer
The Transformer has done its work and can release all associated resource.

Specified by:
release in interface Transformer<Buffer,Object>
Overrides:
release in class SequenceDecoder<Object>
Parameters:
storage - the external state storage, where Transformer could retrieve or store its state.

createSequence

protected Object createSequence(AttributeStorage storage,
                                int size)
Description copied from class: SequenceDecoder
Creates a sequence object with certain size.

Specified by:
createSequence in class SequenceDecoder<Object>
Parameters:
storage - attribute storage
size - the sequence size

set

protected void set(AttributeStorage storage,
                   Object sequence,
                   Object component)
Description copied from class: SequenceDecoder
Stores an element into the sequence.

Specified by:
set in class SequenceDecoder<Object>
Parameters:
storage - attribute storage.
sequence - sequence object.
component - sequence element.

next

protected boolean next(AttributeStorage storage,
                       Object sequence)
Description copied from class: SequenceDecoder
Moves to next sequence element and makes it current. Returns true, if there is next elements in sequence, or false otherwise.

Specified by:
next in class SequenceDecoder<Object>
Parameters:
storage - attribute storage.
sequence - sequence object.
Returns:
true, if there is next elements in sequence, or false otherwise.

size

protected int size(AttributeStorage storage,
                   Object sequence)
Description copied from class: SequenceDecoder
Returns the size of the sequence.

Specified by:
size in class SequenceDecoder<Object>
Parameters:
storage - attribute storage.
sequence - sequence object.
Returns:
the size of the sequence.


Copyright © 2009 SUN Microsystems. All Rights Reserved.