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 tags.
10   *
11   * @version $Id: RPMSignatureTag.java,v 1.4 2004/05/06 20:59:24 mkuss Exp $
12   */
13  public final class RPMSignatureTag implements EnumIf {
14      public static final RPMSignatureTag UNKNOWN = new RPMSignatureTag(_UNKNOWN, "UNKNOWN");
15      public static final int _HEADERSIGNATURES = 62;
16      public static final RPMSignatureTag HEADERSIGNATURES = new RPMSignatureTag(_HEADERSIGNATURES, "HEADERSIGNATURES");
17      public static final int _BADSHA1_1 = 264;
18      public static final RPMSignatureTag BADSHA1_1 = new RPMSignatureTag(_BADSHA1_1, "BADSHA1_1");
19      public static final int _BADSHA1_2 = 265;
20      public static final RPMSignatureTag BADSHA1_2 = new RPMSignatureTag(_BADSHA1_2, "BADSHA1_2");
21      public static final int _DSA = 267;
22      public static final RPMSignatureTag DSA = new RPMSignatureTag(_DSA, "DSA");
23      public static final int _RSA = 268;
24      public static final RPMSignatureTag RSA = new RPMSignatureTag(_RSA, "RSA");
25      public static final int _SHA1 = 269;
26      public static final RPMSignatureTag SHA1 = new RPMSignatureTag(_SHA1, "SHA1");
27      public static final int _SIZE = 1000;
28      public static final RPMSignatureTag SIZE = new RPMSignatureTag(_SIZE, "SIZE");
29      public static final int _LEMD5_1 = 1001;
30      public static final RPMSignatureTag LEMD5_1 = new RPMSignatureTag(_LEMD5_1, "LEMD5_1");
31      public static final int _PGP = 1002;
32      public static final RPMSignatureTag PGP = new RPMSignatureTag(_PGP, "PGP");
33      public static final int _LEMD5_2 = 1003;
34      public static final RPMSignatureTag LEMD5_2 = new RPMSignatureTag(_LEMD5_2, "LEMD5_2");
35      public static final int _MD5 = 1004;
36      public static final RPMSignatureTag MD5 = new RPMSignatureTag(_MD5, "MD5");
37      public static final int _GPG = 1005;
38      public static final RPMSignatureTag GPG = new RPMSignatureTag(_GPG, "GPG");
39      public static final int _PGP5 = 1006;
40      public static final RPMSignatureTag PGP5 = new RPMSignatureTag(_PGP5, "PGP5");
41      public static final int _PAYLOADSIZE = 1007;
42      public static final RPMSignatureTag PAYLOADSIZE = new RPMSignatureTag(_PAYLOADSIZE, "PAYLOADSIZE");
43      private EnumIf delegate;
44  
45      private RPMSignatureTag(int signature, String name) {
46          delegate = new EnumDelegate(RPMSignatureTag.class, signature, name, this);
47      }
48  
49      /***
50       * Get a enum by id
51       *
52       * @param id The id of the enum
53       * @return The enum object
54       */
55      public static EnumIf getEnumById(long id) {
56          return EnumDelegate.getEnumById(RPMSignatureTag.class, id);
57      }
58  
59      /***
60       * Get a enum by name
61       *
62       * @param name The name of the enum
63       * @return The enum object
64       */
65      public static EnumIf getEnumByName(String name) {
66          return EnumDelegate.getEnumByName(RPMSignatureTag.class, name);
67      }
68  
69      /***
70       * Get all defined enums of this class
71       *
72       * @return An array of all defined enum objects
73       */
74      public static String[] getEnumNames() {
75          return EnumDelegate.getEnumNames(RPMSignatureTag.class);
76      }
77  
78      /***
79       * Get a enum of this class by id
80       *
81       * @param signature The id
82       * @return The enum object
83       */
84      public static RPMSignatureTag getRPMSignatureTag(int signature) {
85          return (RPMSignatureTag) getEnumById(signature);
86      }
87  
88      /***
89       * Check if this enum class contains a enum of a specified id
90       *
91       * @param id The id of the enum
92       * @return TRUE if the enum is defined in this class
93       */
94      public static boolean containsEnumId(Long id) {
95          return EnumDelegate.containsEnumId(RPMSignatureTag.class, id);
96      }
97  
98      /*
99       * @see com.jguild.jrpm.io.constant.EnumIf#getId()
100      */
101     public long getId() {
102         return delegate.getId();
103     }
104 
105     /*
106      * @see com.jguild.jrpm.io.constant.EnumIf#getName()
107      */
108     public String getName() {
109         return delegate.getName();
110     }
111 
112     /*
113      * @see java.lang.Object#toString()
114      */
115     public String toString() {
116         return delegate.toString();
117     }
118 }