com.unboundid.scim.marshal.json
Class JsonParser

java.lang.Object
  extended by com.unboundid.scim.marshal.json.JsonParser
Direct Known Subclasses:
JsonBulkParser

public class JsonParser
extends Object

Helper class for JSON unmarshalling.


Constructor Summary
JsonParser()
           
 
Method Summary
protected  SCIMAttribute create(AttributeDescriptor descriptor, Object jsonAttribute)
          Create a SCIM attribute from its JSON object representation.
protected  SCIMAttributeValue createComplexAttribute(org.json.JSONObject jsonAttribute, AttributeDescriptor attributeDescriptor)
          Parse a complex attribute from its representation as a JSON Object.
protected  SCIMAttribute createMutiValuedAttribute(org.json.JSONArray jsonAttribute, AttributeDescriptor attributeDescriptor)
          Parse a multi-valued attribute from its representation as a JSON Object.
protected  SCIMAttribute createSimpleAttribute(Object jsonAttribute, AttributeDescriptor attributeDescriptor)
          Parse a simple attribute from its representation as a JSON Object.
protected
<R extends BaseResource>
R
unmarshal(org.json.JSONObject jsonObject, ResourceDescriptor resourceDescriptor, ResourceFactory<R> resourceFactory, org.json.JSONArray defaultSchemas)
          Read a SCIM resource from the specified JSON object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonParser

public JsonParser()
Method Detail

unmarshal

protected <R extends BaseResource> R unmarshal(org.json.JSONObject jsonObject,
                                               ResourceDescriptor resourceDescriptor,
                                               ResourceFactory<R> resourceFactory,
                                               org.json.JSONArray defaultSchemas)
                                    throws org.json.JSONException,
                                           InvalidResourceException
Read a SCIM resource from the specified JSON object.

Type Parameters:
R - The type of resource instance.
Parameters:
jsonObject - The JSON object to be read.
resourceDescriptor - The descriptor of the SCIM resource to be read.
resourceFactory - The resource factory to use to create the resource instance.
defaultSchemas - The set of schemas used by attributes of the resource, or null if the schemas must be provided in the resource object.
Returns:
The SCIM resource that was read.
Throws:
org.json.JSONException - If an error occurred.
InvalidResourceException - if a schema error occurs.

createSimpleAttribute

protected SCIMAttribute createSimpleAttribute(Object jsonAttribute,
                                              AttributeDescriptor attributeDescriptor)
Parse a simple attribute from its representation as a JSON Object.

Parameters:
jsonAttribute - The JSON object representing the attribute.
attributeDescriptor - The attribute descriptor.
Returns:
The parsed attribute.

createMutiValuedAttribute

protected SCIMAttribute createMutiValuedAttribute(org.json.JSONArray jsonAttribute,
                                                  AttributeDescriptor attributeDescriptor)
                                           throws org.json.JSONException,
                                                  InvalidResourceException
Parse a multi-valued attribute from its representation as a JSON Object.

Parameters:
jsonAttribute - The JSON object representing the attribute.
attributeDescriptor - The attribute descriptor.
Returns:
The parsed attribute.
Throws:
org.json.JSONException - Thrown if error creating multi-valued attribute.
InvalidResourceException - if a schema error occurs.

createComplexAttribute

protected SCIMAttributeValue createComplexAttribute(org.json.JSONObject jsonAttribute,
                                                    AttributeDescriptor attributeDescriptor)
                                             throws org.json.JSONException,
                                                    InvalidResourceException
Parse a complex attribute from its representation as a JSON Object.

Parameters:
jsonAttribute - The JSON object representing the attribute.
attributeDescriptor - The attribute descriptor.
Returns:
The parsed attribute.
Throws:
org.json.JSONException - Thrown if error creating complex attribute.
InvalidResourceException - if a schema error occurs.

create

protected SCIMAttribute create(AttributeDescriptor descriptor,
                               Object jsonAttribute)
                        throws org.json.JSONException,
                               InvalidResourceException
Create a SCIM attribute from its JSON object representation.

Parameters:
descriptor - The attribute descriptor.
jsonAttribute - The JSON object representing the attribute.
Returns:
The created SCIM attribute.
Throws:
org.json.JSONException - If the JSON object is not valid.
InvalidResourceException - If a schema error occurs.


Copyright © 2011-2012 UnboundID. All Rights Reserved.