View Javadoc

1   /**
2    * Copyright 2006 Matthew Purland (m.purland@gmail.com)
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.mud4j.ability;
18  
19  /**
20   * An exception that occurs related to an exceptional condition with
21   * an ability.
22   *  
23   * @author Matthew Purland
24   */
25  public class AbilityException extends Exception {
26      
27      // Ability that the exceptio occurred upon.
28      private Ability ability;
29      
30      /**
31       * Create an ability exception that can be tracked
32       * to a particular ability.
33       * 
34       * @param ability Ability that throwed the exception.
35       */
36      public AbilityException(Ability ability) {
37          super();
38          this.ability = ability;
39      }
40      
41      /**
42       * Creates an ability exception that can be tracked
43       * to a particular ability with a message.
44       * 
45       * @param message Exception message for the exception.
46       * @param ability Ability that throwed the exception.
47       */
48      public AbilityException(String message, Ability ability) {
49          super(message);
50          this.ability = ability;
51      }
52      
53      /**
54       * Return the ability.
55       * @return Returns an ability for the exception.
56       */
57      public Ability getAbility() {
58          return ability;
59      }
60  }