Package gov.usgs.earthquake.product.io
Class JsonProduct
- java.lang.Object
-
- gov.usgs.earthquake.product.io.JsonProduct
-
public class JsonProduct extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description JsonProduct()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,Content>
getContents(javax.json.JsonArray json)
Convert contents json to map.javax.json.JsonArrayBuilder
getContentsJson(java.util.Map<java.lang.String,Content> contents)
Convert contents map to json.javax.json.JsonObjectBuilder
getGeometryJson(Product product)
Create json geometry from product properties.ProductId
getId(javax.json.JsonObject json)
Convert json id to ProductId object.javax.json.JsonObjectBuilder
getIdJson(ProductId id)
Convert ProductId to json object.javax.json.JsonObject
getJsonObject(Product product)
Convert product object to json.java.util.Map<java.lang.String,java.util.List<java.net.URI>>
getLinks(javax.json.JsonArray json)
Convert json links to map.javax.json.JsonArrayBuilder
getLinksJson(java.util.Map<java.lang.String,java.util.List<java.net.URI>> links)
Convert links map to json.Product
getProduct(javax.json.JsonObject json)
Convert json object to product.java.util.Map<java.lang.String,java.lang.String>
getProperties(javax.json.JsonObject json)
Convert properties json to map.javax.json.JsonObjectBuilder
getPropertiesJson(java.util.Map<java.lang.String,java.lang.String> properties)
Convert properties map to json.
-
-
-
Method Detail
-
getJsonObject
public javax.json.JsonObject getJsonObject(Product product) throws java.lang.Exception
Convert product object to json.- Parameters:
product
- a product- Returns:
- a json object
- Throws:
java.lang.Exception
- if error occurs
-
getProduct
public Product getProduct(javax.json.JsonObject json) throws java.lang.Exception
Convert json object to product.- Parameters:
json
- a json object- Returns:
- a product
- Throws:
java.lang.Exception
- if error occurs
-
getContentsJson
public javax.json.JsonArrayBuilder getContentsJson(java.util.Map<java.lang.String,Content> contents) throws java.lang.Exception
Convert contents map to json.- Parameters:
contents
- contents map- Returns:
- JSOnArrayBuilder
- Throws:
java.lang.Exception
- if error occurs
-
getContents
public java.util.Map<java.lang.String,Content> getContents(javax.json.JsonArray json) throws java.lang.Exception
Convert contents json to map.- Parameters:
json
- JsonArray- Returns:
- Contents map
- Throws:
java.lang.Exception
- if error occurs
-
getGeometryJson
public javax.json.JsonObjectBuilder getGeometryJson(Product product) throws java.lang.Exception
Create json geometry from product properties.- Parameters:
product
- a product- Returns:
- JSON geometry via JsonObjectBuilder
- Throws:
java.lang.Exception
- if error occurs
-
getId
public ProductId getId(javax.json.JsonObject json) throws java.lang.Exception
Convert json id to ProductId object.- Parameters:
json
- A JsonObject ID- Returns:
- a productId
- Throws:
java.lang.Exception
- if error occurs
-
getIdJson
public javax.json.JsonObjectBuilder getIdJson(ProductId id) throws java.lang.Exception
Convert ProductId to json object.- Parameters:
id
- A ProductId- Returns:
- JsonObjectBuilder
- Throws:
java.lang.Exception
- if error occurs
-
getLinks
public java.util.Map<java.lang.String,java.util.List<java.net.URI>> getLinks(javax.json.JsonArray json) throws java.lang.Exception
Convert json links to map.- Parameters:
json
- a Jsonarray- Returns:
- a Map of links
- Throws:
java.lang.Exception
- if error occurs
-
getLinksJson
public javax.json.JsonArrayBuilder getLinksJson(java.util.Map<java.lang.String,java.util.List<java.net.URI>> links) throws java.lang.Exception
Convert links map to json.- Parameters:
links
- map- Returns:
- JsonArray of JsonArrayBuilder
- Throws:
java.lang.Exception
- if error occurs
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties(javax.json.JsonObject json) throws java.lang.Exception
Convert properties json to map.- Parameters:
json
- JsonObject properties- Returns:
- A map
- Throws:
java.lang.Exception
- if error occurs
-
getPropertiesJson
public javax.json.JsonObjectBuilder getPropertiesJson(java.util.Map<java.lang.String,java.lang.String> properties) throws java.lang.Exception
Convert properties map to json.- Parameters:
properties
- Map of properties- Returns:
- JsonObjectBuilder
- Throws:
java.lang.Exception
- if error occurs
-
-