Class EntityJson

    • Constructor Detail

      • EntityJson

        public EntityJson​(IEntityJsonInstanceContext context)
                   throws InvalidInstanceException
        Construct an EntityJson from the given context. Each object within the EntityJSON structure is parsed and validated against the general StructuredObject schema. Callers who wish to validate individual objects against their specific schema need to call validate() on each object in turn, using this object as an Iterable if desired. Although this class and its constructor are public, it is not envisaged that clients will call it directly, rather one would expect instances to be obtained via EntityJsonParser.parseStructuredObject(...)
        Parameters:
        context - A parser context.
        Throws:
        InvalidInstanceException - If the EntityJSON structure contains elements whch are not valid STructuredObjects.
    • Method Detail

      • getContext

        public IEntityJsonInstanceContext getContext()
        Return the parse context from which this object was created, which includes error reports if the input was invalid in some way.
        Returns:
        The parse context from which this object was created.
      • getChildren

        public List<StructuredObject> getChildren()
        Return the StructuredObjects contained within this object as a list.
        Returns:
        The StructuredObjects contained within this object.
      • get

        @Nullable
        public StructuredObject get​(String name)
        Return the StructuredObject for the given name, or null.
        Parameters:
        name - The name of the required object.
        Returns:
        The required child object, or null if the given name does not exist.
      • size

        public int size()
        As per the method of the same name in java.util.List
      • isEmpty

        public boolean isEmpty()
        As per the method of the same name in java.util.List
      • contains

        public boolean contains​(StructuredObject o)
        As per the method of the same name in java.util.List
      • get

        public StructuredObject get​(int index)
        As per the method of the same name in java.util.List