View Javadoc

1   package net.sourceforge.pmd;
2   
3   /***
4    * Enumeration of the types of source code.
5    *
6    * @author Pieter_Van_Raemdonck - Application Engineers NV/SA - www.ae.be
7    */
8   public final class SourceType {
9       public static final SourceType JAVA_13 = new SourceType("java 1.3");
10      public static final SourceType JAVA_14 = new SourceType("java 1.4");
11      public static final SourceType JAVA_15 = new SourceType("java 1.5");
12      public static final SourceType JSP = new SourceType("jsp");
13  
14      private String id;
15  
16      /***
17       * Private constructor.
18       *
19       * @param id
20       */
21      private SourceType(String id) {
22          setId(id);
23      }
24  
25      public String getId() {
26          return id;
27      }
28  
29      private void setId(String id) {
30          this.id = id;
31      }
32  
33      public boolean equals(Object other) {
34          if (other == null) {
35              return false;
36          }
37  
38          if (other instanceof SourceType) {
39              return ((SourceType) other).getId().equals(getId());
40          }
41  
42          return false;
43      }
44  
45      public int hashCode() {
46          return getId().hashCode();
47      }
48  
49      /* (non-Javadoc)
50       * @see java.lang.Object#toString()
51       */
52      public String toString() {
53          return "SourceType [" + getId() + "]";
54      }
55  }