public abstract class AbstractApduResponseParser
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractApduResponseParser.StatusProperties
This internal class provides Status code properties
|
Modifier and Type | Field and Description |
---|---|
protected AbstractApduCommandBuilder |
builder
Parsers are usually created by their associated builder.
|
protected ApduResponse |
response
the
ApduResponse containing response. |
protected static java.util.Map<java.lang.Integer,AbstractApduResponseParser.StatusProperties> |
STATUS_TABLE
This Map stores expected status that could be .
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractApduResponseParser(ApduResponse response,
AbstractApduCommandBuilder builder)
(protected)
The generic abstract constructor to build a parser of the APDU response. |
Modifier and Type | Method and Description |
---|---|
protected KeypleCardCommandException |
buildCommandException(java.lang.Class<? extends KeypleCardCommandException> exceptionClass,
java.lang.String message,
CardCommand commandRef,
java.lang.Integer statusCode)
Builds a command exception.
|
void |
checkStatus()
This method check the status code.
If status code is not referenced, then status is considered unsuccessful. |
ApduResponse |
getApduResponse()
Gets
ApduResponse |
AbstractApduCommandBuilder |
getBuilder()
Gets
AbstractApduCommandBuilder , the associated builder reference |
protected CardCommand |
getCommandRef()
Gets the associated command reference.
By default, the command reference is retrieved from the associated builder. |
java.lang.String |
getStatusInformation()
Gets he ASCII message from the statusTable for the current status code.
|
protected java.util.Map<java.lang.Integer,AbstractApduResponseParser.StatusProperties> |
getStatusTable()
Returns the internal status table
|
boolean |
isSuccessful()
Gets true if the status is successful from the statusTable according to the current status
code.
|
protected static final java.util.Map<java.lang.Integer,AbstractApduResponseParser.StatusProperties> STATUS_TABLE
protected final ApduResponse response
ApduResponse
containing response.protected final AbstractApduCommandBuilder builder
protected AbstractApduResponseParser(ApduResponse response, AbstractApduCommandBuilder builder)
response
- ApduResponse
response to parse (should not be null)builder
- AbstractApduCommandBuilder
the reference of the builder that created the
parserprotected java.util.Map<java.lang.Integer,AbstractApduResponseParser.StatusProperties> getStatusTable()
protected KeypleCardCommandException buildCommandException(java.lang.Class<? extends KeypleCardCommandException> exceptionClass, java.lang.String message, CardCommand commandRef, java.lang.Integer statusCode)
This method should be override in subclasses in order to create specific exceptions.
exceptionClass
- the exception classmessage
- the messagecommandRef
- CardCommand
the command referencestatusCode
- the status codepublic final ApduResponse getApduResponse()
ApduResponse
public AbstractApduCommandBuilder getBuilder()
AbstractApduCommandBuilder
, the associated builder referencepublic boolean isSuccessful()
public void checkStatus()
KeypleCardCommandException
- if status is not successful.protected CardCommand getCommandRef()
public final java.lang.String getStatusInformation()