public Resource mapRelations(Resource object,JSONObject jsonObject,List<Resource> included) throws Exception {
  HashMap<String,String> relationshipNames=getRelationshipNames(object.getClass());
  for (  String relationship : relationshipNames.keySet()) {
    JSONObject relationJsonObject=null;
    try {
      relationJsonObject=jsonObject.getJSONObject(relationship);
    }
 catch (    JSONException e) {
      Logger.debug("Relationship named " + relationship + "not found in JSON");
      continue;
    }
    JSONObject relationDataObject=null;
    try {
      relationDataObject=relationJsonObject.getJSONObject("data");
      Resource relationObject=Factory.newObjectFromJSONObject(relationDataObject,null);
      relationObject=matchIncludedToRelation(relationObject,included);
      mDeserializer.setField(object,relationshipNames.get(relationship),relationObject);
    }
 catch (    JSONException e) {
      Logger.debug("JSON relationship does not contain data");
    }
    JSONArray relationDataArray=null;
    try {
      relationDataArray=relationJsonObject.getJSONArray("data");
      List<Resource> relationArray=Factory.newObjectFromJSONArray(relationDataArray,null);
      relationArray=matchIncludedToRelation(relationArray,included);
      mDeserializer.setField(object,relationshipNames.get(relationship),relationArray);
    }
 catch (    JSONException e) {
      Logger.debug("JSON relationship does not contain data");
    }
  }
  return object;
}

public Resource mapRelations ( Resource object , JSONObject jsonObject , List < Resource > included ) throws Exception { HashMap < String , String > relationshipNames = getRelationshipNames ( object . getClass ( ) ) ; for ( String relationship : relationshipNames . keySet ( ) ) { JSONObject relationJsonObject = null ; try { relationJsonObject = jsonObject . getJSONObject ( relationship ) ; } catch ( JSONException e ) { Logger . debug ( "Relationship named " + relationship + "not found in JSON" ) ; continue ; } JSONObject relationDataObject = null ; try { relationDataObject = relationJsonObject . getJSONObject ( "data" ) ; Resource relationObject = Factory . newObjectFromJSONObject ( relationDataObject , null ) ; relationObject = matchIncludedToRelation ( relationObject , included ) ; mDeserializer . setField ( object , relationshipNames . get ( relationship ) , relationObject ) ; } catch ( JSONException e ) { Logger . debug ( "JSON relationship does not contain data" ) ; } JSONArray relationDataArray = null ; try { relationDataArray = relationJsonObject . getJSONArray ( "data" ) ; List < Resource > relationArray = Factory . newObjectFromJSONArray ( relationDataArray , null ) ; relationArray = matchIncludedToRelation ( relationArray , included ) ; mDeserializer . setField ( object , relationshipNames . get ( relationship ) , relationArray ) ; } catch ( JSONException e ) { Logger . debug ( "JSON relationship does not contain data" ) ; } } return object ; }
loops through relation json array and maps annotated objects .
