org.rosuda.REngine
Class REXPMismatchException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.rosuda.REngine.REXPMismatchException
All Implemented Interfaces:
java.io.Serializable

public class REXPMismatchException
extends java.lang.Exception

This exception is thrown whenever the operation requested is not supported by the given R object type, e.g. using asStrings on an S4 object. Most REXP methods throw this exception. Previous R/Java interfaces were silently returning null in those cases, but using exceptions helps to write more robust code.

See Also:
Serialized Form

Constructor Summary
REXPMismatchException(REXP sender, java.lang.String access)
          primary constructor.
 
Method Summary
 java.lang.String getAccess()
          get the assumed access type that was violated by the sender.
 REXP getSender()
          retrieve the exception sender/origin
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

REXPMismatchException

public REXPMismatchException(REXP sender,
                             java.lang.String access)
primary constructor. The exception message will be formed as "attempt to access <REXP-class> as <access-string>"

Parameters:
sender - R object that triggered this exception (cannot be null!)
access - assumed type of the access that was requested. It should be a simple name of the assumed type (e.g. "vector"). The type name can be based on R semantics beyond basic types reflected by REXP classes. In cases where certain assertions were not satisfied, the string should be of the form "type (assertion)" (e.g. "data frame (must have dim>0)").
Method Detail

getSender

public REXP getSender()
retrieve the exception sender/origin

Returns:
REXP object that triggered the exception

getAccess

public java.lang.String getAccess()
get the assumed access type that was violated by the sender.

Returns:
string describing the access type. See REXPMismatchException(org.rosuda.REngine.REXP, java.lang.String) for details.