Class JsonWriteContext.TryWrite

  • Enclosing class:
    JsonWriteContext

    public static class JsonWriteContext.TryWrite
    extends java.lang.Object
    Try.style monad for stateful write to the write context, handling first writes specially.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected JsonWriteContext context
      Wrute context.
      protected boolean first
      First write state.
      protected boolean onlyfirst
      Write only first attempt.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JsonWriteContext write​(java.lang.String value)
      Write or not depending on state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • first

        protected boolean first
        First write state.
      • onlyfirst

        protected boolean onlyfirst
        Write only first attempt.
    • Constructor Detail

      • TryWrite

        public TryWrite​(JsonWriteContext context)
        Initialized the monad.
        Parameters:
        context - Write context.
      • TryWrite

        public TryWrite​(JsonWriteContext context,
                        boolean onlyfirst)
        Initialized the monad.
        Parameters:
        context - Write context.
        onlyfirst - Write only on first write instead of every write except the first.
    • Method Detail

      • write

        public JsonWriteContext write​(java.lang.String value)
        Write or not depending on state.
        Parameters:
        value - Value to write.
        Returns:
        The context for convenience.