001/**
002 * Copyright 2005-2018 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.web.controller;
017
018import org.kuali.rice.core.api.exception.RiceRuntimeException;
019
020/**
021 * Runtime exception thrown when a controller method is requested that is not accessible.
022 *
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public class MethodAccessException extends RiceRuntimeException {
026    private static final long serialVersionUID = -4173237177827444387L;
027
028    private final Class<?> controllerClass;
029    private final String methodToCall;
030
031    public MethodAccessException(Class<?> controllerClass, String methodToCall) {
032        super("Access is protected for controller: " + controllerClass.getName() + " and method: " + methodToCall);
033
034        this.controllerClass = controllerClass;
035        this.methodToCall = methodToCall;
036    }
037
038    /**
039     * Class of the controller the method was requested for.
040     *
041     * @return controller class
042     */
043    public Class<?> getControllerClass() {
044        return controllerClass;
045    }
046
047    /**
048     * Name of the controller method that was requested.
049     *
050     * @return controller method name
051     */
052    public String getMethodToCall() {
053        return methodToCall;
054    }
055}