Class Attachment
- java.lang.Object
-
- com.nimbusds.openid.connect.sdk.assurance.evidences.attachment.Attachment
-
- Direct Known Subclasses:
EmbeddedAttachment
,ExternalAttachment
public abstract class Attachment extends Object
Identity evidence attachment.Related specifications:
- OpenID Connect for Identity Assurance 1.0, section 5.1.2.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Attachment(AttachmentType type, String description)
Creates a new attachment with the specified description.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getDescriptionString()
Returns the description.AttachmentType
getType()
Returns the type of this attachment.int
hashCode()
static Attachment
parse(net.minidev.json.JSONObject jsonObject)
Parses an identity evidence attachment from the specified JSON object.static List<Attachment>
parseList(net.minidev.json.JSONArray jsonArray)
Parses a list of identity evidence attachments from the specified JSON array.EmbeddedAttachment
toEmbeddedAttachment()
Casts this attachment to an embedded attachment.ExternalAttachment
toExternalAttachment()
Casts this attachment to an external attachment.net.minidev.json.JSONObject
toJSONObject()
Returns a JSON object representation of this attachment.
-
-
-
Constructor Detail
-
Attachment
protected Attachment(AttachmentType type, String description)
Creates a new attachment with the specified description.- Parameters:
type
- The type. Must not benull
.description
- The description,null
if not specified.
-
-
Method Detail
-
getType
public AttachmentType getType()
Returns the type of this attachment.- Returns:
- The type.
-
getDescriptionString
public String getDescriptionString()
Returns the description.- Returns:
- The description string.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Returns a JSON object representation of this attachment.- Returns:
- The JSON object.
-
toEmbeddedAttachment
public EmbeddedAttachment toEmbeddedAttachment()
Casts this attachment to an embedded attachment.- Returns:
- The embedded attachment.
- Throws:
ClassCastException
- If the cast failed.
-
toExternalAttachment
public ExternalAttachment toExternalAttachment()
Casts this attachment to an external attachment.- Returns:
- The external attachment.
- Throws:
ClassCastException
- If the cast failed.
-
parse
public static Attachment parse(net.minidev.json.JSONObject jsonObject) throws ParseException
Parses an identity evidence attachment from the specified JSON object.- Parameters:
jsonObject
- The JSON object. Must not benull
.- Returns:
- The identity evidence attachment.
- Throws:
ParseException
- If parsing failed.
-
parseList
public static List<Attachment> parseList(net.minidev.json.JSONArray jsonArray) throws ParseException
Parses a list of identity evidence attachments from the specified JSON array.- Parameters:
jsonArray
- The JSON array,null
if not specified.- Returns:
- The list of identity evidence attachments,
null
if not specified. - Throws:
ParseException
- If parsing failed.
-
-