Interface JsonObjectBase<JVB extends JsonValueBase<JVB>>

Type Parameters:
JVB - the type of a JSON implementation wrapper
All Superinterfaces:
Iterable<Map.Entry<String,JVB>>, Jsonable, JsonValueBase<JVB>
All Known Subinterfaces:
JsonObjectCore<JVC>
All Known Implementing Classes:
GsonJsonObject, JacksonJsonObject, JakartaJsonObject, OrgJsonObject

public interface JsonObjectBase<JVB extends JsonValueBase<JVB>> extends Iterable<Map.Entry<String,JVB>>, JsonValueBase<JVB>
JsonObjectBase extends JsonValueBase and adds essential methods which should be included in any JSON object implementation.
Author:
Wei-Ming Wu
  • Method Details

    • contains

      boolean contains(String name)
      Checks if this JSON object contains given field name.
      Parameters:
      name - a field name
      Returns:
      true if this JSON object contains given field name, false otherwise
    • get

      JVB get(String name)
      Returns a JSON value wrapper by given field name.
      Parameters:
      name - a field name
      Returns:
      a JSON value wrapper
    • size

      int size()
      Returns the size of this JSON object.
      Returns:
      an int
    • names

      Iterator<String> names()
      Returns field names of this JSON object.
      Returns:
      an Iterator of field names
    • isEmpty

      default boolean isEmpty()
      Checks if this JSON object is empty.
      Returns:
      true if this JSON object is empty, false otherwise
    • toMap

      default Map<String,Object> toMap()
      Converts this JSON object to a Java Map.
      Returns:
      a Map
    • stream

      default Stream<Map.Entry<String,JVB>> stream()
      Turns this JSON object into a Stream of Entry<String, JsonValueBase>.
      Returns:
      a Stream