001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.devutils.stateless;
018
019import org.apache.wicket.Component;
020import org.apache.wicket.Page;
021import org.apache.wicket.WicketRuntimeException;
022
023/**
024 *
025 * Just an exception that can be thrown if a StatelessChecker is invoked, the component being checked is not stateless
026 * or the behavior held by the component is not stateless.
027 *
028 * Includes a  method that to get check failure component.
029 *
030 * @author Ken Sakurai
031 */
032public class StatelessCheckFailureException  extends WicketRuntimeException
033{
034        private static final long serialVersionUID = 1L;
035
036        private Component component;
037
038        /**
039         * Construct.
040         * @param component Failure component
041         * @param reason Reason for exception occurrence
042         */
043        public StatelessCheckFailureException(Component component, String reason)
044        {
045                super("'" + component + "' claims to be stateless but isn't." + reason);
046                this.component = component;
047        }
048
049        /**
050         * Get check failure component
051         * @return Failure component
052         */
053        public Component getComponent()
054        {
055                return component;
056        }
057}