org.simalliance.openmobileapi.service
Class SmartcardError

java.lang.Object
  extended by org.simalliance.openmobileapi.service.SmartcardError
All Implemented Interfaces:
android.os.Parcelable

public class SmartcardError
extends java.lang.Object
implements android.os.Parcelable

Smartcard service parameter class used to marshal exception information from the smartcard service to clients.


Nested Class Summary
 
Nested classes/interfaces inherited from interface android.os.Parcelable
android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
 
Field Summary
static android.os.Parcelable.Creator<SmartcardError> CREATOR
           
 
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
 
Constructor Summary
SmartcardError()
          Creates an empty smartcard error container.
SmartcardError(java.lang.String clazz, java.lang.String message)
          Creates a smartcard error which creates the specified exception.
 
Method Summary
 void clear()
          Clears the error.
 java.lang.Exception createException()
          Creates the encoded exception.
 int describeContents()
           
 void readFromParcel(android.os.Parcel in)
           
 void setError(java.lang.Class clazz, java.lang.String message)
          Sets the error information.
 void throwException()
          Throws the encoded exception.
 void writeToParcel(android.os.Parcel out, int flags)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATOR

public static final android.os.Parcelable.Creator<SmartcardError> CREATOR
Constructor Detail

SmartcardError

public SmartcardError()
Creates an empty smartcard error container.


SmartcardError

public SmartcardError(java.lang.String clazz,
                      java.lang.String message)
Creates a smartcard error which creates the specified exception.

Parameters:
clazz - the exception class. null to reset the error information.
message - the exception message.
Method Detail

clear

public void clear()
Clears the error.


createException

public java.lang.Exception createException()
Creates the encoded exception. Returns null if empty. If the encoded exception is neither a RuntimeException nor a CardException, it is encapsulated in a RuntimeException.

Returns:
the encoded exception or null if empty.

describeContents

public int describeContents()
Specified by:
describeContents in interface android.os.Parcelable

readFromParcel

public void readFromParcel(android.os.Parcel in)

setError

public void setError(java.lang.Class clazz,
                     java.lang.String message)
Sets the error information.

Parameters:
clazz - the exception class. null to reset the error information.
message - the exception message.

throwException

public void throwException()
                    throws CardException
Throws the encoded exception. Does not throw an exception if the container is empty. If the encoded exception is neither a RuntimeException nor a CardException, it is encapsulated in a RuntimeException.

Throws:
java.lang.RuntimeException - if the encoded exception is not a CardException.
CardException - if a CardException is encoded.

writeToParcel

public void writeToParcel(android.os.Parcel out,
                          int flags)
Specified by:
writeToParcel in interface android.os.Parcelable