Interface ReadContext

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Configuration configuration()
      Returns the configuration used for reading
      <T> T json()
      Returns the JSON model that this context is operating on
      java.lang.String jsonString()
      Returns the JSON model that this context is operating on as a JSON string
      ReadContext limit​(int maxResults)
      Stops evaluation when maxResults limit has been reached
      <T> T read​(JsonPath path)
      Reads the given path from this context
      <T> T read​(JsonPath path, TypeRef<T> typeRef)
      Reads the given path from this context Sample code to create a TypeRef TypeRef ref = new TypeRef>() {};
      <T> T read​(JsonPath path, java.lang.Class<T> type)
      Reads the given path from this context
      <T> T read​(java.lang.String path, Predicate... filters)
      Reads the given path from this context
      <T> T read​(java.lang.String path, TypeRef<T> typeRef)
      Reads the given path from this context Sample code to create a TypeRef TypeRef ref = new TypeRef>() {};
      <T> T read​(java.lang.String path, java.lang.Class<T> type, Predicate... filters)
      Reads the given path from this context
      ReadContext withListeners​(EvaluationListener... listener)
      Adds listener to the evaluation of this path
    • Method Detail

      • configuration

        Configuration configuration()
        Returns the configuration used for reading
        Returns:
        an immutable configuration
      • json

        <T> T json()
        Returns the JSON model that this context is operating on
        Returns:
        json model
      • jsonString

        java.lang.String jsonString()
        Returns the JSON model that this context is operating on as a JSON string
        Returns:
        json model as string
      • read

        <T> T read​(java.lang.String path,
                   Predicate... filters)
        Reads the given path from this context
        Type Parameters:
        T -
        Parameters:
        path - path to read
        filters - filters
        Returns:
        result
      • read

        <T> T read​(java.lang.String path,
                   java.lang.Class<T> type,
                   Predicate... filters)
        Reads the given path from this context
        Type Parameters:
        T -
        Parameters:
        path - path to read
        type - expected return type (will try to map)
        filters - filters
        Returns:
        result
      • read

        <T> T read​(JsonPath path)
        Reads the given path from this context
        Type Parameters:
        T -
        Parameters:
        path - path to apply
        Returns:
        result
      • read

        <T> T read​(JsonPath path,
                   java.lang.Class<T> type)
        Reads the given path from this context
        Type Parameters:
        T -
        Parameters:
        path - path to apply
        type - expected return type (will try to map)
        Returns:
        result
      • read

        <T> T read​(JsonPath path,
                   TypeRef<T> typeRef)
        Reads the given path from this context Sample code to create a TypeRef TypeRef ref = new TypeRef>() {};
        Type Parameters:
        T -
        Parameters:
        path - path to apply
        typeRef - expected return type (will try to map)
        Returns:
        result
      • read

        <T> T read​(java.lang.String path,
                   TypeRef<T> typeRef)
        Reads the given path from this context Sample code to create a TypeRef TypeRef ref = new TypeRef>() {};
        Type Parameters:
        T -
        Parameters:
        path - path to apply
        typeRef - expected return type (will try to map)
        Returns:
        result
      • limit

        ReadContext limit​(int maxResults)
        Stops evaluation when maxResults limit has been reached
        Parameters:
        maxResults -
        Returns:
        the read context
      • withListeners

        ReadContext withListeners​(EvaluationListener... listener)
        Adds listener to the evaluation of this path
        Parameters:
        listener - listeners to add
        Returns:
        the read context