org.modeshape.web.jcr.rest.client.json

## Class JsonNode

- java.lang.Object
- - org.codehaus.jettison.json.JSONObject
  - - org.modeshape.web.jcr.rest.client.json.JsonNode

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    FileNode, FolderNode, NodeTypeNode, RepositoryNode, ServerNode, WorkspaceNode

      public abstract class JsonNode
      extends org.codehaus.jettison.json.JSONObject

  The `JsonNode` class defines the API for interacting with JSON objects. Every `JsonNode` knows how to create their URL and create their JCR content.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.codehaus.jettison.json.JSONObject

      `NULL`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JsonNode(String id)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.codehaus.jettison.json.JSONObject` | `children()`
    `byte[]` | `getContent()`
    `String` | `getId()`
    `abstract URL` | `getUrl()`
    `protected org.codehaus.jettison.json.JSONObject` | `properties()`
    `String` | `toString()`
    `protected JsonNode` | `withChild(String name, org.codehaus.jettison.json.JSONObject child)`
    `protected JsonNode` | `withMixin(String mixin)`
    `protected JsonNode` | `withPrimaryType(String primaryType)`
    `protected JsonNode` | `withProperty(String key, Object value)`

    - ### Methods inherited from class org.codehaus.jettison.json.JSONObject

      `accumulate, append, doubleToString, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getString, has, isNull, keys, length, names, numberToString, opt, optBoolean, optBoolean, optDouble, optDouble, optInt, optInt, optJSONArray, optJSONObject, optLong, optLong, optString, optString, put, put, put, put, put, put, put, putOpt, quote, remove, toJSONArray, toString, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### JsonNode

          protected JsonNode(String id)

      Parameters:
        `id` - the node identifier (never `null`)

  - ### Method Detail

    - #### getContent

          public byte[] getContent()
                            throws Exception

      Returns:
        the content that gets published
      Throws:
        `Exception` - if there is a problem obtaining the node content

    - #### getId

          public String getId()

      Returns:
        a unique identifier for this node

    - #### getUrl

          public abstract URL getUrl()
                              throws Exception

      Returns:
        an HTTP URL representing this node
      Throws:
        `Exception` - if there is a problem constructing the URL

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `org.codehaus.jettison.json.JSONObject`

    - #### withPrimaryType

          protected JsonNode withPrimaryType(String primaryType)
                                      throws org.codehaus.jettison.json.JSONException

      Throws:
        `org.codehaus.jettison.json.JSONException`

    - #### withMixin

          protected JsonNode withMixin(String mixin)
                                throws org.codehaus.jettison.json.JSONException

      Throws:
        `org.codehaus.jettison.json.JSONException`

    - #### withProperty

          protected JsonNode withProperty(String key,
                              Object value)
                                   throws org.codehaus.jettison.json.JSONException

      Throws:
        `org.codehaus.jettison.json.JSONException`

    - #### withChild

          protected JsonNode withChild(String name,
                           org.codehaus.jettison.json.JSONObject child)
                                throws org.codehaus.jettison.json.JSONException

      Throws:
        `org.codehaus.jettison.json.JSONException`

    - #### children

          protected org.codehaus.jettison.json.JSONObject children()
                                                            throws org.codehaus.jettison.json.JSONException

      Throws:
        `org.codehaus.jettison.json.JSONException`

    - #### properties

          protected org.codehaus.jettison.json.JSONObject properties()
                                                              throws org.codehaus.jettison.json.JSONException

      Throws:
        `org.codehaus.jettison.json.JSONException`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.