View Javadoc

1   /*
2    * Copyright 2004 Carlos Sanchez.
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 net.sf.oness.common.model.exceptions;
17  
18  import java.util.Collection;
19  
20  /***
21   * Exception thrown when trying to create an object similar to others
22   * that already exist
23   * 
24   * @author Carlos Sanchez
25   * @version $Revision: 1.3 $
26   */
27  public class ExistingInstanceException extends ModelException {
28  
29      private Object object;
30      private String className;
31      private Collection existingInstances;
32  
33      /***
34       * @param object
35       * @param className name of the object class
36       * @param existingInstances
37       */
38      public ExistingInstanceException(
39          Object object,
40          String className,
41          Collection existingInstances) {
42          super("Existing instance");
43          this.object = object;
44          this.className = className;
45          this.existingInstances = existingInstances;
46      }
47  
48      public Object getObject() {
49          return object;
50      }
51  
52      public String getClassName() {
53          return className;
54      }
55  
56      public Collection getExistingInstances() {
57          return existingInstances;
58      }
59  
60  }