Class AJsonObjectTokenProcessor

java.lang.Object
provided.owlMaps.cefUtils.gson.AJsonObjectTokenProcessor

public abstract class AJsonObjectTokenProcessor
extends java.lang.Object
Abstract visitor JSON object token read processor for use with the GSON library. Assumes that the JSON reader is about to read an object. Provides default behavior for all the cases. Implementations should override the desired cases, saving values via their closures. Usage: To process the object token, run the process() method.
Author:
swong
  • Constructor Summary

    Constructors
    Constructor Description
    AJsonObjectTokenProcessor()  
  • Method Summary

    Modifier and Type Method Description
    void caseBeginArray​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that begins an array definition.
    void caseBeginObject​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that begins an object definition.
    void caseBoolean​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that represents a boolean value.
    void caseEndArray​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that ends an array definition.
    void caseEndObject​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that ends an object definition.
    void caseName​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that indicates the name of a field in an object.
    void caseNull​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that represents a null value.
    void caseNumber​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that represents a number value.
    void caseString​(com.google.gson.stream.JsonReader jsonReader)
    Process the token that represents a string value.
    void process​(com.google.gson.stream.JsonReader jsonReader)
    Process the next token in the stream by delegating to the associated case for that type of token

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AJsonObjectTokenProcessor

      public AJsonObjectTokenProcessor()
  • Method Details

    • process

      public void process​(com.google.gson.stream.JsonReader jsonReader)
      Process the next token in the stream by delegating to the associated case for that type of token
      Parameters:
      jsonReader - The reader for the JSON token stream
    • caseBeginObject

      public void caseBeginObject​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that begins an object definition. Defaults to configuring the jsonReader to begin reading an object definition.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.
    • caseEndObject

      public void caseEndObject​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that ends an object definition. Defaults to configuring the jsonReader to stop reading an object definition.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.
    • caseBeginArray

      public void caseBeginArray​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that begins an array definition. Defaults to configuring the jsonReader to begin reading an array definition.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.
    • caseEndArray

      public void caseEndArray​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that ends an array definition. Defaults to configuring the jsonReader to stop reading an array definition.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.
    • caseName

      public void caseName​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that indicates the name of a field in an object. jsonReader.nextName() will read the String value of the name. Follow nextName() with jsonReader.nextDouble()/String()/Boolean()/etc to read out the value of the field. Defaults to reading and printing but otherwise ignoring the value and advancing to the next token.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.
    • caseNumber

      public void caseNumber​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that represents a number value. Use jsonReader.nextDouble() to read the value. Defaults to reading and printing but otherwise ignoring the value and advancing to the next token.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.
    • caseString

      public void caseString​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that represents a string value. Use jsonReader.nextString() to read the value. Defaults to reading and printing but otherwise ignoring the value and advancing to the next token.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.
    • caseBoolean

      public void caseBoolean​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that represents a boolean value. Use jsonReader.nextBoolean() to read the value. Defaults to reading and printing but otherwise ignoring the value and advancing to the next token.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.
    • caseNull

      public void caseNull​(com.google.gson.stream.JsonReader jsonReader) throws java.io.IOException
      Process the token that represents a null value. Use jsonReader.nextNull() to skip to the next token.
      Parameters:
      jsonReader - The reader for the JSON token stream
      Throws:
      java.io.IOException - Thrown if there is an error reading the token stream.