View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
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.apache.commons.betwixt.io;
17  
18  /***
19    * <p>Thrown when bean evaluation finds a cycle reference.</p>
20    *
21    * <p>There are two possible behaviours that <code>Betwixt</code> adopts when 
22    * a cycle in the object graph is encountered.
23    *
24    * <p>If <code>ID</code> attributes are being generated, 
25    * then the recursion will stop and the <code>IDREF</code> attribute will be
26    * written. 
27    * In this case, <em>no exception will be thrown</em>.</p>
28    *
29    * <p>If <code>ID</code> are <strong>not</strong> being generated, 
30    * then this exception will be thrown.</p>
31    *
32    * @author <a href="mailto:rdonkin@apache.org">Robert Burrell Donkin</a>
33    * @version $Revision: 1.6 $
34    */
35  public class CyclicReferenceException extends RuntimeException {
36      
37      /*** Message used with empty constructor */
38      private static final String DEFAULT_MESSAGE 
39          = "Bean graph contains a cyclic reference";
40          
41      /*** Construct exception with default message.
42        */
43      public CyclicReferenceException() {
44          super(DEFAULT_MESSAGE);
45      }
46      
47      /***  
48       * Construct exception with message
49       *
50       * @param message the detailed message string
51       */
52      public CyclicReferenceException(String message) {
53          super(message);
54      }
55  }