Package com.yetanalytics.xapi.model
Class Extensions
- java.lang.Object
-
- com.yetanalytics.xapi.model.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.
-
-
Constructor Summary
Constructors Constructor Description Extensions(Map<String,Object> input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
get(String key)
Retrieve extension dataSet<String>
getKeys()
Returns a set of all IRI Extension keysMap<String,Object>
getMap()
Returns the full raw Extension Map as a HashMap<String, Object>void
put(String key, Object value)
Sets an entry in the Extensions Map<T> T
read(String key, String jsonPathExpression, Class<T> typeKey)
Attempt a JSONPath query of the Extension data.void
remove(String key)
Remove an extension by IRI key
-
-
-
Method Detail
-
put
public void put(String key, Object value)
Sets an entry in the Extensions Map- Parameters:
key
- the IRI key of the extensionvalue
- 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 queryjsonPathExpression
- A JSONPath query to perform in the Extension datatypeKey
- 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
-
-