Package

io.dylemma.spac

handlers

Permalink

package handlers

Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractHandler[In, Out] extends Handler[In, Out]

    Permalink
  2. abstract class AbstractTakeWhileHandler[In, Out] extends Handler[In, Out]

    Permalink
  3. class CollectHandler[A, B, Out] extends TransformerHandler[A, B, Out]

    Permalink
  4. class CompoundHandler[In, B, Out] extends Handler[In, Out]

    Permalink

    A composition of a number of "inner" handlers which delegates each event to each (unfinished) inner handler, then reforms a final result based on the final results of each of the inner handlers.

    A composition of a number of "inner" handlers which delegates each event to each (unfinished) inner handler, then reforms a final result based on the final results of each of the inner handlers.

    Used internally by ParserChain

    In

    The input type for each of the inner handlers

    B

    A base type for the results of all of the innerHandlers. This will typically be Any or Result[Any].

    Out

    The type of the final combined result

  5. class ConstantHandler[T] extends Handler[Any, T]

    Permalink

    Handler that will produce the result in response to any input or end event, and will re-throw any error that gets passed.

  6. class DropNHandler[In, Out] extends TransformerHandler[In, In, Out]

    Permalink
  7. class DropWhileHandler[In, Out] extends TransformerHandler[In, In, Out]

    Permalink
  8. class EndWithErrorTransformerHandler[In, Out] extends Handler[In, Out]

    Permalink

    Transformer handler that will ignore all inputs, instead passing the given error exactly once to the downstream handler.

    Transformer handler that will ignore all inputs, instead passing the given error exactly once to the downstream handler.

    In

    The input type

    Out

    The output type

  9. class FilteringHandler[In, Out] extends TransformerHandler[In, In, Out]

    Permalink
  10. trait FinishOnError extends AnyRef

    Permalink
  11. class FoldHandler[A, R] extends Handler[A, R] with ManualFinish

    Permalink
  12. class ForEachHandler[A] extends Handler[A, Unit] with ManualFinish

    Permalink
  13. class GetFirstHandler[A] extends Handler[A, A] with ManualFinish

    Permalink
  14. class GetFirstOptionHandler[A] extends Handler[A, Option[A]] with ManualFinish

    Permalink
  15. class MandatoryAttributeHandler extends Handler[XMLEvent, Try[String]] with ManualFinish with FinishOnError

    Permalink
  16. trait ManualFinish extends AnyRef

    Permalink
  17. class MappedConsumerHandler[In, A, B] extends Handler[In, B]

    Permalink

    Mapping handler which applies a transformation function to the results coming from the wrapped handler.

  18. class MappedTransformerHandler[A, B, Out] extends TransformerHandler[A, B, Out]

    Permalink

    Mapping handler which applies a transformation function to inputs before passing them to the downstream handler.

  19. class OneShotHandler[Out] extends Handler[Any, Out]

    Permalink
  20. class OptionalAttributeHandler extends Handler[XMLEvent, Try[Option[String]]] with ManualFinish with FinishOnError

    Permalink
  21. class ParallelTransformerHandler[In, A, Out] extends Handler[In, Out]

    Permalink

    A handler for a collection of transformers that will be run in parallel.

    A handler for a collection of transformers that will be run in parallel. Each event passed through this handler will be forwarded to each of the respective handlers for the transformers in toMerge, referred to as "members". If at any point a member finishes, it will no longer receive inputs. If at any point *all* of the members finish, an early end will be passed to the downstream handler. If at any point the downstream handler emits a result, that result will be returned and the members will be deactivated.

    In

    The input type

    A

    The common output type of the transformers, and the input type for the downstream handler.

    Out

    The output type

  22. class SafeConsumerHandler[In, Out] extends Handler[In, Try[Out]]

    Permalink

    Wraps an inner handler's methods with a try, wrapping the output type with Try[_]

  23. class ScanningHandler[S, A, Out] extends TransformerHandler[A, S, Out]

    Permalink

    A handler that starts with some initial state, and each for each input the current state is forwarded to the downstream handler, and the state is updated according to the provided function f.

    A handler that starts with some initial state, and each for each input the current state is forwarded to the downstream handler, and the state is updated according to the provided function f. The final state is passed when handleEnd is called.

  24. class SequencedInStackHandler[In, T1, T2] extends Handler[In, T2]

    Permalink

    Handler that forwards inputs to a first handler until that handler yields a result, at which point the result is used to create a second handler, to which all further inputs are forwarded until it yields a result.

    Handler that forwards inputs to a first handler until that handler yields a result, at which point the result is used to create a second handler, to which all further inputs are forwarded until it yields a result.

    Before the second handler is generated, the input "stack" is tracked so that it can be replayed to the second handler (so that it can acquire the correct context even though it was not available when the inputs forming that context were initially handled). The "stack" behavior is generalized with the Stackable typeclass.

    An example usage of this is to faciliate creation of a Parser for an XML element which starts with some "dictionary" element, followed by a large number of "data" objects that reference the dictionary. Normally, a user of xml-spac would have to choose between;

    • loading the large list of data objects into a List (high memory usage) in order to use regular parser combination methods like and
    • creating an external map and having the dictionary parser side effect by populating the map, and the data object parser read from that map (this is against the spirit of xml-spac since it breaks the immutability/encapsulation of the parser). Instead, with this handler, the user can write a parser for the dictionary element and have its result be passed into the parser for its sibling elements (the data elements). No external mutable state is required.
    In

    The input type

    T1

    The first handler's result type

    T2

    The second handler's result type

  25. class SideEffectHandler[A, Out] extends TransformerHandler[A, A, Out]

    Permalink
  26. class SplitOnMatchHandler[In, Context, P, Out] extends SplitterHandlerBase[In, Context, P, Out]

    Permalink
  27. trait SplitterHandlerBase[In, Context, P, Out] extends Handler[In, Out]

    Permalink

    Created by dylan on 7/9/2016.

  28. class TakeNHandler[In, Out] extends AbstractTakeWhileHandler[In, Out]

    Permalink
  29. class TakeWhileHandler[In, Out] extends AbstractTakeWhileHandler[In, Out]

    Permalink
  30. class TextCollectorHandler extends Handler[XMLEvent, Try[String]] with ManualFinish with FinishOnError

    Permalink
  31. class ToListHandler[A] extends Handler[A, List[A]] with ManualFinish

    Permalink
  32. trait TransformerHandler[A, B, Out] extends Handler[A, Out]

    Permalink

    Base implementation for Handlers that transform and/or filter inputs before passing them along to some downstream handler.

    Base implementation for Handlers that transform and/or filter inputs before passing them along to some downstream handler.

    A

    The input type

    B

    The transformed input type, which corresponds to the input type of the downstream handler

    Out

    The downstream handler's output type

  33. class UnwrapSafeConsumerHandler[In, Out] extends Handler[In, Out]

    Permalink

    Unwraps an inner handler whose output type is a Try, so that any Failure returned from the inner handler will have its underlying error thrown.

  34. class UnwrapSafeTransformerHandler[A, B] extends Handler[Try[A], B]

    Permalink

    Handler that delegates to an inner handler, converting result-typed inputs to the corresponding handleInput or handleError call.

  35. class WrapSafeTransformerHandler[A, B] extends Handler[A, B]

    Permalink

    Handler that upgrades events from the upstream to Results before passing them to the inner handler.

    Handler that upgrades events from the upstream to Results before passing them to the inner handler. This way, the inner handler will never have its handleError method called.

  36. class XMLContextSplitterHandler[Context, P, Out] extends SplitterHandlerBase[XMLEvent, Context, P, Out]

    Permalink
  37. class XMLHandlerException extends Exception with NoStackTrace

    Permalink

Value Members

  1. object TransformerHandler

    Permalink
  2. object Util

    Permalink
  3. object XMLHandlerException extends Serializable

    Permalink

Ungrouped