com.sap.portal.navigation.json.list

Class JSONList

java.lang.Object
  extended by com.sap.portal.navigation.json.list.JSONList

public class JSONList
extends Object

Represents a list of items to be used in a JSON list.
The list contains a LinkedHashMap that maintains paired values of categories and list items.
Each category contains a LinkedList of items to maintain the insertion order. When adding an item to the list, if the item's category attribute is valid (not empty and not null),
a corresponding category is added to the LinkedHashMap and the item is added to the category's LinkedList.
If the category already exists, the item is added to the category's LinkedList.
If the item does not have a category, it is added to the default category, defined by the JSONListConstants.DEFAULT_CATEGORY key.
The default category is always first when consuming the list.


Constructor Summary
JSONList()
          Default constructor
 
Method Summary
 void addItem(JSONListItem item)
          Adds an item to the list
 void removeItem(JSONListItem item)
          Remove an JSONListItem from the list
 String toJSON()
          This method iterates through the items in the list and returns the toString() representation of a JSON array that contains all of the list items
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONList

public JSONList()
Default constructor

Method Detail

addItem

public void addItem(JSONListItem item)
             throws IllegalArgumentException
Adds an item to the list

Parameters:
item - JSONListItem to add
Throws:
IllegalArgumentException - in case item is null

removeItem

public void removeItem(JSONListItem item)
                throws IllegalArgumentException
Remove an JSONListItem from the list

Parameters:
item - JSONListItem to be removed
Throws:
IllegalArgumentException - in case item is null or item does not exist in the list

toJSON

public String toJSON()
This method iterates through the items in the list and returns the toString() representation of a JSON array that contains all of the list items

Returns:
The toString() representation of a JSON array that contains all of the list items
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] EP-RUNTIME [sap.com] tc/ep/navigation/api api EP-PIN


Copyright 2015 SAP AG Complete Copyright Notice