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     */ 
017    package org.apache.commons.betwixt.io;
018    
019    /**
020      * <p>Thrown when bean evaluation finds a cycle reference.</p>
021      *
022      * <p>There are two possible behaviours that <code>Betwixt</code> adopts when 
023      * a cycle in the object graph is encountered.
024      *
025      * <p>If <code>ID</code> attributes are being generated, 
026      * then the recursion will stop and the <code>IDREF</code> attribute will be
027      * written. 
028      * In this case, <em>no exception will be thrown</em>.</p>
029      *
030      * <p>If <code>ID</code> are <strong>not</strong> being generated, 
031      * then this exception will be thrown.</p>
032      *
033      * @author <a href="mailto:rdonkin@apache.org">Robert Burrell Donkin</a>
034      * @version $Revision: 438373 $
035      */
036    public class CyclicReferenceException extends RuntimeException {
037        
038        /** Message used with empty constructor */
039        private static final String DEFAULT_MESSAGE 
040            = "Bean graph contains a cyclic reference";
041            
042        /** Construct exception with default message.
043          */
044        public CyclicReferenceException() {
045            super(DEFAULT_MESSAGE);
046        }
047        
048        /**  
049         * Construct exception with message
050         *
051         * @param message the detailed message string
052         */
053        public CyclicReferenceException(String message) {
054            super(message);
055        }
056    }