com.spss.psapi.content

Interface JSONContentModel

  • All Superinterfaces:
    ContentModel


    public interface JSONContentModel
    extends ContentModel
    An interface that provides a mechanism for accessing the JSON content of a ContentContainer. Content is accessed using lists of strings or integers. Strings are used to access named children in the JSON object while integers are used to access specific values in JSON arrays.
    Since:
    PSAPI 17.0
    See Also:
    ContentContainer
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.util.List<java.lang.Object> getChildrenAt(java.util.List<java.lang.Object> path, com.ibm.json.java.JSONArtifact artifact)
      Returns the list of objects at the specified path if the path leads to a JSON array or null otherwise.
      java.util.Map<java.lang.Object,java.lang.Object> getChildValuesAt(java.util.List<java.lang.Object> path, com.ibm.json.java.JSONArtifact artifact)
      Returns the child values of the specified path if the path leads to a JSON object or null otherwise.
      java.lang.String getJSONAsString()
      Returns the JSON content as a string.
      java.lang.Object getObjectAt(java.util.List<java.lang.Object> path, com.ibm.json.java.JSONArtifact artifact)
      Returns the object at the specified path.
    • Method Detail

      • getJSONAsString

        java.lang.String getJSONAsString()
        Returns the JSON content as a string.
        Returns:
        the JSON content
      • getObjectAt

        java.lang.Object getObjectAt(java.util.List<java.lang.Object> path,
                                   com.ibm.json.java.JSONArtifact artifact)
                                     throws java.lang.Exception
        Returns the object at the specified path. The supplied root artifact may be null in which case the root of the content is used. The returned value may be a literal string, integer, real or boolean, or a JSON artifact (either a JSON object or a JSON array).
        Parameters:
        path - the path to the required object
        artifact - the starting artifact or null
        Returns:
        the object at the specified location
        Throws:
        java.lang.Exception - if there is an error parsing the JSON or when accessing specific content
      • getChildValuesAt

        java.util.Map<java.lang.Object,java.lang.Object> getChildValuesAt(java.util.List<java.lang.Object> path,
                                                                        com.ibm.json.java.JSONArtifact artifact)
                                                                          throws java.lang.Exception
        Returns the child values of the specified path if the path leads to a JSON object or null otherwise. The keys in the table are strings while the associated value may be a literal string, integer, real or boolean, or a JSON artifact (either a JSON object or a JSON array).
        Parameters:
        path - the path to the required object
        artifact - the starting artifact or null
        Returns:
        a hash table containing the child values
        Throws:
        java.lang.Exception - if there is an error parsing the JSON or when accessing specific content
      • getChildrenAt

        java.util.List<java.lang.Object> getChildrenAt(java.util.List<java.lang.Object> path,
                                                     com.ibm.json.java.JSONArtifact artifact)
                                                       throws java.lang.Exception
        Returns the list of objects at the specified path if the path leads to a JSON array or null otherwise. The returned values may be a literal string, integer, real or boolean, or a JSON artifact (either a JSON object or a JSON array).
        Parameters:
        path - the path to the required object
        artifact - the starting artifact or null
        Returns:
        a list of child values
        Throws:
        java.lang.Exception - if there is an error parsing the JSON or when accessing specific content

(C) Copyright IBM Corp. 1994, 2015. All Rights Reserved.