View Javadoc

1   /*
2    * Copyright 2007-2008 Naoki NOSE.
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  package jp.liq.container.vocabulary;
17  
18  import jp.liq.container.util.AbstractException;
19  
20  /**
21   * クラスのメンバを取得する際に発生する例外です。
22   * @author nose
23   */
24  public class VocabularyException extends AbstractException {
25      private static final long serialVersionUID = -2406215957713803677L;
26      /**
27       * メンバの取得に失敗した原因です。
28       * @author nose
29       */
30      public static enum Reason {
31          /**
32           * コンストラクタが複数存在するため、どのコンストラクタを返してよいのか不明。
33           */
34          TOO_MANY_CONSTRUCTOR, 
35          /**
36           * 指定されたパラメータ型を持つコンストラクタが見つからない。
37           */
38          FAILED_TO_FIND_CONSTRUCTOR,
39          /**
40           * 指定された名称及びパラメータ型を持つメソッドが見つからない。
41           */
42          FAILED_TO_FIND_METHOD,
43          /**
44           * 型のマッピングが不正
45           */
46          INVALID_MAPPING;
47      }
48      /**
49       * このクラスの新しいインスタンスを構築します。
50       * @param ownerClass 取得に失敗したメンバを保持するクラス。
51       * @param reason 失敗の理由。
52       */
53      public VocabularyException(Class<?> ownerClass,
54              Reason reason) {
55          super(reason, ownerClass);
56      }
57  
58      /**
59       * このクラスの新しいインスタンスを構築します。
60       * @param reason 失敗の理由
61       * @param args 引数 
62       */
63      public VocabularyException(Reason reason, Object... args) {
64      	super(reason, args);
65      }
66  
67      /**
68       * このクラスの新しいインスタンスを構築します。
69       * @param cause 起因例外。
70       * @param ownerClass 取得に失敗したメンバを保持するクラス。
71       * @param reason 失敗の理由。
72       */
73      public VocabularyException(Throwable cause,
74              Class<?> ownerClass, Reason reason) {
75          super(cause, reason, ownerClass);
76      }
77  }