View Javadoc

1   /*
2    * jGuild Project: jRPM
3    * Released under the Apache License ( http://www.apache.org/LICENSE )
4    */
5   package com.jguild.jrpm.io.constant;
6   
7   
8   /***
9    * Constants for Lead type.
10   *
11   * @version $Id: LeadType.java,v 1.3 2003/10/20 16:32:12 mkuss Exp $
12   */
13  public final class LeadType implements EnumIf {
14      public static final LeadType UNKNOWN = new LeadType(_UNKNOWN, "UNKNOWN");
15      public static final int _BINARY = 0;
16      public static final LeadType BINARY = new LeadType(_BINARY, "BINARY");
17      public static final int _SOURCE = 1;
18      public static final LeadType SOURCE = new LeadType(_SOURCE, "SOURCE");
19      private EnumIf delegate;
20  
21      private LeadType(int type, String name) {
22          delegate = new EnumDelegate(LeadType.class, type, name, this);
23      }
24  
25      /***
26       * Get a enum by id
27       *
28       * @param id The id of the enum
29       * @return The enum object
30       */
31      public static EnumIf getEnumById(long id) {
32          return EnumDelegate.getEnumById(LeadType.class, id);
33      }
34  
35      /***
36       * Get a enum by name
37       *
38       * @param name The name of the enum
39       * @return The enum object
40       */
41      public static EnumIf getEnumByName(String name) {
42          return EnumDelegate.getEnumByName(LeadType.class, name);
43      }
44  
45      /***
46       * Get all defined enums of this class
47       *
48       * @return An array of all defined enum objects
49       */
50      public static String[] getEnumNames() {
51          return EnumDelegate.getEnumNames(LeadType.class);
52      }
53  
54      /***
55       * Get a enum of this class by id
56       *
57       * @param type The id
58       * @return The enum object
59       */
60      public static LeadType getLeadType(int type) {
61          return (LeadType) getEnumById(type);
62      }
63  
64      /***
65       * Check if this enum class contains a enum of a specified id
66       *
67       * @param id The id of the enum
68       * @return TRUE if the enum is defined in this class
69       */
70      public static boolean containsEnumId(Long id) {
71          return EnumDelegate.containsEnumId(LeadType.class, id);
72      }
73  
74      /*
75       * @see com.jguild.jrpm.io.constant.EnumIf#getId()
76       */
77      public long getId() {
78          return delegate.getId();
79      }
80  
81      /*
82       * @see com.jguild.jrpm.io.constant.EnumIf#getName()
83       */
84      public String getName() {
85          return delegate.getName();
86      }
87  
88      /*
89       * @see java.lang.Object#toString()
90       */
91      public String toString() {
92          return delegate.toString();
93      }
94  }