KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > core > urls > URLType


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.core.urls;
19
20 /**
21  * Passed to {@link URLRewriter#rewriteURL} for normal (non-resource) and resource, non-secure and
22  * secure URLs.
23  */

24 public class URLType
25 {
26     protected static final int INT_ACTION = 0;
27     protected static final int INT_RESOURCE = 1;
28     
29     public static final URLType ACTION = new URLType( INT_ACTION );
30     public static final URLType RESOURCE = new URLType( INT_RESOURCE );
31     
32     private int _val;
33     
34     private URLType( int val )
35     {
36         _val = val;
37     }
38     
39     public String JavaDoc toString()
40     {
41         switch ( _val )
42         {
43             case INT_ACTION: return "action";
44             case INT_RESOURCE: return "resource";
45         }
46         
47         assert false : _val;
48         return "<unknown URLType>";
49     }
50     
51     public boolean equals( Object JavaDoc o )
52     {
53         if ( o == null ) return false;
54         if ( o == this ) return true;
55         if ( ! ( o instanceof URLType ) ) return false;
56         return ( ( URLType ) o )._val == _val;
57     }
58     
59     public int hashCode()
60     {
61         return _val;
62     }
63 }
64
Popular Tags