View Javadoc

1   /*
2    * Copyright 2005 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  
17  package org.apache.jdo.impl.model.java;
18  
19  import org.apache.jdo.model.java.JavaType;
20  
21  /***
22   * An instance of class ErrorType represents an erroneous type. Components
23   * such as the semantic analysis may use this type to indicate an error
24   * situtaion. It is compatible to all other types. 
25   * 
26   * @author Michael Bouschen
27   * @since JDO 1.0.1
28   */
29  public class ErrorType
30      extends AbstractJavaType
31  {
32      /*** The singleton ErrorType instance. */
33      public static final ErrorType errorType = new ErrorType();
34  
35      /*** 
36       * Creates new a ErrorType instance. This constructor should not be 
37       * called directly; instead, the singleton instance  {@link #errorType}
38       * should be used. 
39       */
40      protected ErrorType() {}
41  
42      /*** 
43       * Returns true if this JavaType is compatible with the specified
44       * JavaType. This implementation always returns <code>true</code>,
45       * because ErrorType is compatible with any other type.
46       * @param javaType the type this JavaType is checked with.
47       * @return <code>true</code> if this is compatible with the specified
48       * type; <code>false</code> otherwise.
49       */
50      public boolean isCompatibleWith(JavaType javaType)
51      {
52          return true;
53      }
54      
55      /*** 
56       * Returns the name of the type.  
57       * @return type name
58       */
59      public String getName()
60      {
61          return "<error type>"; //NOI18N
62      }
63  
64  }