KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > SecurityProtocol


1 /*
2  * Copyright 2004 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  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow;
19
20 /**
21  * Enumeration to represent secure/unsecure/unspecified values associated with paths in the webapp.
22  */

23 public class SecurityProtocol
24 {
25     protected static final int INT_SECURE = 0;
26     protected static final int INT_UNSECURE = 1;
27     protected static final int INT_UNSPECIFIED = 2;
28     
29     public static final SecurityProtocol SECURE = new SecurityProtocol( INT_SECURE );
30     public static final SecurityProtocol UNSECURE = new SecurityProtocol( INT_UNSECURE );
31     public static final SecurityProtocol UNSPECIFIED = new SecurityProtocol( INT_UNSPECIFIED );
32     
33     private int _val;
34     
35     private SecurityProtocol( int val )
36     {
37         _val = val;
38     }
39     
40     public String JavaDoc toString()
41     {
42         switch ( _val )
43         {
44             case INT_SECURE : return "secure";
45             case INT_UNSECURE: return "unsecure";
46             case INT_UNSPECIFIED: return "unspecified";
47         }
48         
49         assert false : _val;
50         return "<unknown Modifier>";
51     }
52     
53     public boolean equals( Object JavaDoc o )
54     {
55         if ( o == null ) return false;
56         if ( o == this ) return true;
57         if ( ! ( o instanceof SecurityProtocol ) ) return false;
58         return ( ( SecurityProtocol ) o )._val == _val;
59     }
60     
61     public int hashCode()
62     {
63         return _val;
64     }
65 }
66
Popular Tags