org.jwalk
Class PermissionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.jwalk.JWalkException
              extended by org.jwalk.PermissionException
All Implemented Interfaces:
java.io.Serializable

public class PermissionException
extends JWalkException

PermissionException signals the refusal to execute a class or a generator. This exception may be raised if an attempt is made to instantiate a class which is non-public, abstract, or an interface. Likewise, it may be raised if the user supplies a non-public or abstract custom generator, which could not then be instantiated and executed. The exception may be queried before it is handled, to support giving different feedback. If testClassRefused() is true, the exception was raised for the test class, which was inaccessible, abstract, or an interface. If generatorRefused() is true, the exception was raised for a custom generator, which was inaccessible, or partly abstract. Access is provided to the class type, or generator type, which denied permission to be executed.

Version:
1.1
Author:
Anthony Simons
See Also:
Serialized Form

Constructor Summary
PermissionException(java.lang.Class<?> type)
          Creates a PermissionException for a class which refused permission to execute.
PermissionException(java.lang.Class<?> type, boolean generator)
          Creates a PermissionException for a generator which refused permission to execute.
PermissionException(java.lang.Class<?> type, java.lang.String message)
          Creates a PermissionException for a class which refused permission to execute, with a specific error message.
 
Method Summary
 boolean generatorRefused()
          Reports whether the refusing class is a generator.
 java.lang.Class<?> getType()
          Returns the type which refused permission to execute.
 boolean testClassRefused()
          Reports whether the refusing class is the test class.
 
Methods inherited from class org.jwalk.JWalkException
getError
 
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

PermissionException

public PermissionException(java.lang.Class<?> type)
Creates a PermissionException for a class which refused permission to execute.

Parameters:
type - the class which refused permission.

PermissionException

public PermissionException(java.lang.Class<?> type,
                           java.lang.String message)
Creates a PermissionException for a class which refused permission to execute, with a specific error message.

Parameters:
type - the class which refused permission.
message - the specific error message.

PermissionException

public PermissionException(java.lang.Class<?> type,
                           boolean generator)
Creates a PermissionException for a generator which refused permission to execute.

Parameters:
type - the class which refused permission.
generator - a flag indicating this was a generator.
Method Detail

getType

public java.lang.Class<?> getType()
Returns the type which refused permission to execute. This could be the test class, or a generator class.


testClassRefused

public boolean testClassRefused()
Reports whether the refusing class is the test class.


generatorRefused

public boolean generatorRefused()
Reports whether the refusing class is a generator.