java.lang.Object
org.glassfish.grizzly.AbstractTransformer<K,L>
- All Implemented Interfaces:
Transformer<K,L>
- Direct Known Subclasses:
ChunkingFilter.ChunkingTransformer,GZipDecoder,GZipEncoder,LZMADecoder,LZMAEncoder,SSLDecoderTransformer,SSLEncoderTransformer,StringDecoder,StringEncoder
- Author:
- Alexey Stashok
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AttributeBuilderprotected final Attribute<AbstractTransformer.LastResultAwareState<K,L>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractTransformer.LastResultAwareState<K,L> final TransformationResult<K,L> getLastResult(AttributeStorage storage) Gets the last returned Transformer result.protected Stringstatic <T> TgetValue(AttributeStorage storage, Attribute<T> attribute, T defaultValue) protected MemoryManagerobtainMemoryManager(AttributeStorage storage) protected final AbstractTransformer.LastResultAwareState<K,L> obtainStateObject(AttributeStorage storage) voidrelease(AttributeStorage storage) The Transformer has done its work and can release all associated resource.protected final TransformationResult<K,L> saveLastResult(AttributeStorage storage, TransformationResult<K, L> result) voidsetMemoryManager(MemoryManager memoryManager) final TransformationResult<K,L> transform(AttributeStorage storage, K input) Transforms an input data to some custom representation.protected abstract TransformationResult<K,L> transformImpl(AttributeStorage storage, K input) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.glassfish.grizzly.Transformer
getName, hasInputRemaining
-
Field Details
-
attributeBuilder
-
stateAttr
-
-
Constructor Details
-
AbstractTransformer
public AbstractTransformer()
-
-
Method Details
-
getNamePrefix
-
transform
public final TransformationResult<K,L> transform(AttributeStorage storage, K input) throws TransformationException Description copied from interface:TransformerTransforms an input data to some custom representation. Input and output are not passed implicitly, which means that Transformer is able to retrieve input and output from its internal state or from external storage (AttributeStorage).- Specified by:
transformin interfaceTransformer<K,L> - Parameters:
storage- the external state storage, where Transformer could get/put a state.input- data to transform- Returns:
- the result
TransformationResult - Throws:
TransformationException- if failed to transport i.e. invalid types
-
transformImpl
protected abstract TransformationResult<K,L> transformImpl(AttributeStorage storage, K input) throws TransformationException - Throws:
TransformationException
-
getLastResult
Description copied from interface:TransformerGets the last returned Transformer result. Last result could be either retrieved from internal state, or external storage, which is passed as the parameter.- Specified by:
getLastResultin interfaceTransformer<K,L> - Parameters:
storage- the external state storage, where Transformer could retrieve or store its state.- Returns:
- the last returned Transformer result.
-
saveLastResult
protected final TransformationResult<K,L> saveLastResult(AttributeStorage storage, TransformationResult<K, L> result) -
release
Description copied from interface:TransformerThe Transformer has done its work and can release all associated resource.- Specified by:
releasein interfaceTransformer<K,L> - Parameters:
storage- the external state storage, where Transformer could retrieve or store its state.
-
obtainMemoryManager
-
getMemoryManager
-
setMemoryManager
-
getValue
-
obtainStateObject
protected final AbstractTransformer.LastResultAwareState<K,L> obtainStateObject(AttributeStorage storage) -
createStateObject
-