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 signature type.
10   *
11   * @version $Id: LeadSignature.java,v 1.3 2003/10/20 16:32:12 mkuss Exp $
12   */
13  public class LeadSignature implements EnumIf {
14      public static final LeadSignature UNKNOWN = new LeadSignature(_UNKNOWN, "UNKNOWN");
15      public static final int _SIZE = 4;
16      public static final LeadSignature SIZE = new LeadSignature(_SIZE, "size");
17      public static final int _MD5 = 5;
18      public static final LeadSignature MD5 = new LeadSignature(_MD5, "MD5");
19      public static final int _PGP = 6;
20      public static final LeadSignature PGP = new LeadSignature(_PGP, "PGP");
21      private EnumIf delegate;
22  
23      private LeadSignature(int signature, String name) {
24          delegate = new EnumDelegate(LeadSignature.class, signature, name, this);
25      }
26  
27      /***
28       * Get a enum by id
29       *
30       * @param id The id of the enum
31       * @return The enum object
32       */
33      public static EnumIf getEnumById(long id) {
34          return EnumDelegate.getEnumById(LeadSignature.class, id);
35      }
36  
37      /***
38       * Get a enum by name
39       *
40       * @param name The name of the enum
41       * @return The enum object
42       */
43      public static EnumIf getEnumByName(String name) {
44          return EnumDelegate.getEnumByName(LeadSignature.class, name);
45      }
46  
47      /***
48       * Get all defined enums of this class
49       *
50       * @return An array of all defined enum objects
51       */
52      public static String[] getEnumNames() {
53          return EnumDelegate.getEnumNames(LeadSignature.class);
54      }
55  
56      /***
57       * Get a enum of this class by id
58       *
59       * @param signature The id
60       * @return The enum object
61       */
62      public static LeadSignature getLeadSignature(int signature) {
63          return (LeadSignature) getEnumById(signature);
64      }
65  
66      /***
67       * Check if this enum class contains a enum of a specified id
68       *
69       * @param id The id of the enum
70       * @return TRUE if the enum is defined in this class
71       */
72      public static boolean containsEnumId(Long id) {
73          return EnumDelegate.containsEnumId(LeadSignature.class, id);
74      }
75  
76      /*
77       * @see com.jguild.jrpm.io.constant.EnumIf#getId()
78       */
79      public long getId() {
80          return delegate.getId();
81      }
82  
83      /*
84       * @see com.jguild.jrpm.io.constant.EnumIf#getName()
85       */
86      public String getName() {
87          return delegate.getName();
88      }
89  
90      /*
91       * @see java.lang.Object#toString()
92       */
93      public String toString() {
94          return delegate.toString();
95      }
96  }