Class Extensions


  • public class Extensions
    extends Object
    A wrapper object for using xAPI Extensions. The extension JSON data is stored in a combination of LinkedHashMap and ArrayList depending on the JSON elements. It can be accessed directly or through a JSONPath API.
    • Method Detail

      • put

        public void put​(String key,
                        Object value)
        Sets an entry in the Extensions Map
        Parameters:
        key - the IRI key of the extension
        value - The Collections API representation of the JSON Data
      • get

        public Object get​(String key)
        Retrieve extension data
        Parameters:
        key - The IRI of the extension
        Returns:
        The Collections API representation of the JSON Data
      • read

        public <T> T read​(String key,
                          String jsonPathExpression,
                          Class<T> typeKey)
        Attempt a JSONPath query of the Extension data.
        Type Parameters:
        T - The type that the query is expecting to convert the results to
        Parameters:
        key - The IRI key of the extension in which to perform the query
        jsonPathExpression - A JSONPath query to perform in the Extension data
        typeKey - The typereference for the type that the query is expecting to retrieve
        Returns:
        Object of type T that is the result of deserialization from the query
      • remove

        public void remove​(String key)
        Remove an extension by IRI key
        Parameters:
        key - the IRI of the extension to remove
      • getKeys

        public Set<String> getKeys()
        Returns a set of all IRI Extension keys
        Returns:
        Set of IRI keys
      • getMap

        public Map<String,​Object> getMap()
        Returns the full raw Extension Map as a HashMap<String, Object>
        Returns:
        The raw Extensions Map