Package com.github.ambry.frontend
Class SignedIdSerDe
- java.lang.Object
-
- com.github.ambry.frontend.SignedIdSerDe
-
public class SignedIdSerDe extends java.lang.Object
Methods to serialize and deserialize JSON strings that contain a blob ID and metadata dictionary. These methods can be used to create serialization formats in implementations ofIdSigningService
. Keep in mind that the strings created by these methods are not URL-safe, signed, or encrypted, and that theIdSigningService
implementation should choose how to handle these concerns.
-
-
Constructor Summary
Constructors Constructor Description SignedIdSerDe()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.github.ambry.utils.Pair<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>
fromJson(java.lang.String jsonString)
static java.lang.String
toJson(java.lang.String blobId, java.util.Map<java.lang.String,java.lang.String> metadata)
-
-
-
Method Detail
-
toJson
public static java.lang.String toJson(java.lang.String blobId, java.util.Map<java.lang.String,java.lang.String> metadata) throws org.json.JSONException
- Parameters:
blobId
- the blob ID to include in the JSON string.metadata
- additional parameters to include in the JSON string.- Returns:
- a JSON string containing the blob ID and additional parameters.
- Throws:
org.json.JSONException
-
fromJson
public static com.github.ambry.utils.Pair<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> fromJson(java.lang.String jsonString) throws org.json.JSONException
- Parameters:
jsonString
- the JSON string to deserialize.- Returns:
- a
Pair
that contains the blob ID and additional metadata parsed from the JSON string. - Throws:
org.json.JSONException
-
-