1 /* 2 * Copyright 2007-2011 smartics, Kronseder & Reiner GmbH 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 de.smartics.exceptions.i18n; 17 18 import de.smartics.exceptions.i18n.app.ConfigurationExceptionCode; 19 import de.smartics.exceptions.i18n.message.MessageParam; 20 import de.smartics.exceptions.i18n.message.ParentMessageParam; 21 22 /** 23 * This exception is thrown if the configuration is not valid so that the system 24 * cannot evaluate the exception property. 25 * 26 * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a> 27 * @version $Revision:591 $ 28 */ 29 @ParentMessageParam("cause=2:message") 30 public class MethodAccessConfigurationException extends 31 PropertyAccessConfigurationException 32 { 33 // ********************************* Fields ********************************* 34 35 // --- constants ------------------------------------------------------------ 36 37 /** 38 * The class version identifier. 39 * <p> 40 * The value of this constant is {@value}. 41 */ 42 private static final long serialVersionUID = 1L; 43 44 // --- members -------------------------------------------------------------- 45 46 /** 47 * The name of the getter method that has been tried to accessed. 48 * 49 * @serial 50 */ 51 @MessageParam("3") 52 protected final String methodName; 53 54 // ****************************** Initializer ******************************* 55 56 // ****************************** Constructors ****************************** 57 58 /** 59 * Constructor. 60 * 61 * @param code the error or exception code of the exception. 62 * @param propertyName the name of the property that cannot be accessed. 63 * @param clazz the class that should contain the property but the information 64 * cannot be accessed. 65 * @param methodName the name of the getter method that has been tried to 66 * accessed. 67 * @see #MethodAccessConfigurationException(Throwable,ConfigurationExceptionCode,java.lang.String,java.lang.Class,java.lang.String) 68 */ 69 public MethodAccessConfigurationException( 70 final ConfigurationExceptionCode code, final String propertyName, 71 final Class<?> clazz, final String methodName) 72 { 73 this(null, code, propertyName, clazz, methodName); 74 } 75 76 /** 77 * Constructor. 78 * 79 * @param cause the cause (which is saved for later retrieval by the 80 * {@link #getCause()} method). (A <tt>null</tt> value is permitted, 81 * and indicates that the cause is nonexistent or unknown.) 82 * @param code the error or exception code of the exception. 83 * @param propertyName the name of the property that cannot be accessed. 84 * @param clazz the class that should contain the property but the information 85 * cannot be accessed. 86 * @param methodName the name of the getter method that has been tried to 87 * accessed. 88 * @see PropertyAccessConfigurationException#PropertyAccessConfigurationException(java.lang.Throwable,ConfigurationExceptionCode,String,Class) 89 */ 90 public MethodAccessConfigurationException(final Throwable cause, 91 final ConfigurationExceptionCode code, final String propertyName, 92 final Class<?> clazz, final String methodName) 93 { 94 super(cause, code, propertyName, clazz); 95 this.methodName = methodName; 96 } 97 98 // ****************************** Inner Classes ***************************** 99 100 // ********************************* Methods ******************************** 101 102 // --- init ----------------------------------------------------------------- 103 104 // --- get&set -------------------------------------------------------------- 105 106 /** 107 * Returns the name of the getter method that has been tried to accessed. 108 * 109 * @return the name of the getter method that has been tried to accessed. 110 */ 111 public String getMethodName() 112 { 113 return methodName; 114 } 115 116 // --- business ------------------------------------------------------------- 117 118 // --- object basics -------------------------------------------------------- 119 }