SK.gnome.dwarf
Class IllegalServiceClassException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bySK.gnome.dwarf.ServiceException
              extended bySK.gnome.dwarf.IllegalServiceClassException
All Implemented Interfaces:
java.io.Serializable

public class IllegalServiceClassException
extends ServiceException

This exception indicates an illegal service type.

It may be thrown in the case an operation is requested on the service whose class type does not allow the operation to be performed on it.

The following code snippet ilustrates a sample usage:

 public class MyService extends GenericService
 { ...
   public void init(Server parent) throws ServiceException
   {
     // accepts only MyServer as the parent server
     if (!(parent instanceof MyServer))
       throw new IllegalServiceClassException(MyServer.class);

     super.init(parent);
   }
   ...
 

Constructors with argument of type java.lang.Class can be used to indicate the required class type.

See Also:
Serialized Form

Field Summary
protected  java.lang.Class cl
          The required class object.
 
Constructor Summary
IllegalServiceClassException()
          Constructs a new IllegalServiceClassException.
IllegalServiceClassException(java.lang.Class cl)
          Constructs a new IllegalServiceClassException with the given required class type.
IllegalServiceClassException(java.lang.String message)
          Constructs a new IllegalServiceClassException with the given message.
IllegalServiceClassException(java.lang.String message, java.lang.Class cl)
          Constructs a new IllegalServiceClassException with the given message and required class type.
 
Method Summary
 java.lang.Class getRequiredClass()
          Returns the required class.
 
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
 

Field Detail

cl

protected java.lang.Class cl
The required class object.

Constructor Detail

IllegalServiceClassException

public IllegalServiceClassException()
Constructs a new IllegalServiceClassException.


IllegalServiceClassException

public IllegalServiceClassException(java.lang.String message)
Constructs a new IllegalServiceClassException with the given message.

Parameters:
message - the message

IllegalServiceClassException

public IllegalServiceClassException(java.lang.String message,
                                    java.lang.Class cl)
Constructs a new IllegalServiceClassException with the given message and required class type.

Parameters:
message - the message
cl - the required class

IllegalServiceClassException

public IllegalServiceClassException(java.lang.Class cl)
Constructs a new IllegalServiceClassException with the given required class type.

Parameters:
cl - the required class
Method Detail

getRequiredClass

public java.lang.Class getRequiredClass()
Returns the required class.

Returns:
the required class


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.