View Javadoc
1   /*
2    *  Copyright 2011 Christopher Pheby
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 org.jadira.bindings.core.binder;
17  
18  /**
19   * Runtime exception thrown when a {@link ConverterKey} cannot be resolved
20   */
21  public class NoConverterFoundException extends RuntimeException {
22  
23  	private static final long serialVersionUID = -8269600136904935415L;
24  
25  	private ConverterKey<?,?> converterKey;
26  
27  	/**
28  	 * Creates a new instance for the given {@link ConverterKey}
29  	 * @param converterKey The ConverterKey for the converter that could not be found 
30  	 */
31  	public NoConverterFoundException(ConverterKey<?,?> converterKey) {
32  		super("No converter found for: " + converterKey.toString());
33  		this.converterKey = converterKey;
34  	}
35  	
36  	/**
37  	 * Get the {@link ConverterKey} used to resolve unsuccessfully
38  	 * @return {@link ConverterKey}
39  	 */
40  	public ConverterKey<?,?> getConverterKey() {
41  		return converterKey;
42  	}
43  }