citysdk.tourism.client.parser
Class JsonParser

java.lang.Object
  extended by citysdk.tourism.client.parser.JsonParser

public class JsonParser
extends java.lang.Object

Parses a given JSON message. It allows the deserialization of:

Author:
pedrocruz

Constructor Summary
JsonParser(java.lang.String json)
          Initializes a JsonParser with the given json string.
 
Method Summary
 java.lang.String getJson()
           
 Category parseJsonAsCategory()
          Parses the JSON as a Category.
 Event parseJsonAsEvent()
          Parses the JSON as an Event.
 Deserializable parseJsonAsGeneric()
          Parses the JSON as a generic POI.
 ListEvent parseJsonAsListOfEvents()
          Parses the JSON as a ListEvent.
 ListPointOfInterest parseJsonAsListOfPois()
          Parses the JSON as a ListPointOfInterest.
 ListRoute parseJsonAsListOfRoutes()
          Parses the JSON as a ListRoute.
 ListPOIS parseJsonAsListPOIS()
          Parses the JSON as a ListPOIS.
 PointOfInterest parseJsonAsPointOfInterest()
          Parses the JSON as a PointOfInterest.
 Resources parseJsonAsResources()
          Parses the JSON as a Resources.
 Route parseJsonAsRoute()
          Parses the JSON as a Route.
 ListTag parseJsonAsTags()
          Parses the JSON as a ListTag.
 void setJson(java.lang.String json)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonParser

public JsonParser(java.lang.String json)
Initializes a JsonParser with the given json string. Such JSON can be replaced by using its setter.

Parameters:
json - the json string containing a given description.
Method Detail

getJson

public java.lang.String getJson()

setJson

public void setJson(java.lang.String json)

parseJsonAsPointOfInterest

public PointOfInterest parseJsonAsPointOfInterest()
                                           throws UnknownErrorException
Parses the JSON as a PointOfInterest.

Returns:
a PointOfInterest containing the content of the JSON message.
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsEvent

public Event parseJsonAsEvent()
                       throws UnknownErrorException
Parses the JSON as an Event.

Returns:
an Event containing the content of the JSON message.
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsRoute

public Route parseJsonAsRoute()
                       throws UnknownErrorException
Parses the JSON as a Route.

Returns:
a Route containing the content of the JSON message
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsListOfPois

public ListPointOfInterest parseJsonAsListOfPois()
                                          throws UnknownErrorException
Parses the JSON as a ListPointOfInterest.

Returns:
a ListPointOfInterest containing the content of the JSON message.
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsListOfEvents

public ListEvent parseJsonAsListOfEvents()
                                  throws UnknownErrorException
Parses the JSON as a ListEvent.

Returns:
a ListEvent containing the content of the JSON message.
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsListOfRoutes

public ListRoute parseJsonAsListOfRoutes()
                                  throws UnknownErrorException
Parses the JSON as a ListRoute.

Returns:
a ListRoute containing the content of the JSON message.
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsResources

public Resources parseJsonAsResources()
                               throws UnknownErrorException
Parses the JSON as a Resources.

Returns:
a Resources containing the content of the JSON message
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsCategory

public Category parseJsonAsCategory()
                             throws UnknownErrorException
Parses the JSON as a Category.

Returns:
a Category containing the content of the JSON message
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsTags

public ListTag parseJsonAsTags()
                        throws UnknownErrorException
Parses the JSON as a ListTag.

Returns:
a ListTag containing the content of the JSON message.
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsListPOIS

public ListPOIS parseJsonAsListPOIS()
                             throws UnknownErrorException
Parses the JSON as a ListPOIS.

Returns:
a ListPOIS containing the content of the JSON message.
Throws:
UnknownErrorException - thrown in case of unforeseen errors.

parseJsonAsGeneric

public Deserializable parseJsonAsGeneric()
                                  throws UnknownErrorException
Parses the JSON as a generic POI.

Returns:
a POI containing the content of the JSON message.
Throws:
UnknownErrorException - thrown in case of unforeseen errors.