KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > AmbiguousComponentResolutionException


1 /*****************************************************************************
2  * Copyright (C) Codehaus.org. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Feb 28, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan;
15
16 import jfun.util.Misc;
17
18 /**
19  * Exception when ambiguity happens for component resolution.
20  * <p>
21  * Codehaus.org.
22  *
23  * @author Ben Yu
24  *
25  */

26 public final class AmbiguousComponentResolutionException extends
27     YanException {
28   private final Object JavaDoc key;
29   private final Class JavaDoc t1;
30   private final Class JavaDoc t2;
31   /**
32    * Gets the key for the component being resolved.
33    * @return the component key.
34    */

35   public Object JavaDoc getComponentKey(){
36     return key;
37   }
38   /**
39    * Gets the type of the first candidate component.s
40    * @return the component type.
41    */

42   public Class JavaDoc getType1() {
43     return t1;
44   }
45   /**
46    * Gets the type of the second candidate component.s
47    * @return the component type.
48    */

49   public Class JavaDoc getType2() {
50     return t2;
51   }
52
53   /**
54    * Create an instance.
55    * @param key the key of the component being resolved.
56    * @param t1 the type of the first candidate.
57    * @param t2 the type of the second candidate.
58    */

59   public AmbiguousComponentResolutionException(final Object JavaDoc key,
60       final Class JavaDoc t1, final Class JavaDoc t2) {
61     super("ambiguous resolution: : both "
62         + Misc.getTypeName(t1) + " and " + Misc.getTypeName(t2)
63         + " resolvable for key " + key);
64     this.key = key;
65     this.t1 = t1;
66     this.t2 = t2;
67   }
68 }
69
Popular Tags