1 55 56 package org.jboss.axis.enums; 57 58 59 62 public class Scope extends Enum 63 { 64 private static final Type type = new Type(); 65 66 public static final String REQUEST_STR = "Request"; 67 public static final String APPLICATION_STR = "Application"; 68 public static final String SESSION_STR = "Session"; 69 70 public static final Scope REQUEST = type.getScope(REQUEST_STR); 71 public static final Scope APPLICATION = type.getScope(APPLICATION_STR); 72 public static final Scope SESSION = type.getScope(SESSION_STR); 73 74 public static final Scope DEFAULT = REQUEST; 75 76 77 static 78 { 79 type.setDefault(DEFAULT); 80 } 81 82 83 87 public static Scope getDefault() 88 { 89 return (Scope)type.getDefault(); 90 } 91 92 public static final Scope getScope(int scope) 93 { 94 return type.getScope(scope); 95 } 96 97 public static final Scope getScope(String scope) 98 { 99 return type.getScope(scope); 100 } 101 102 public static final Scope getScope(String scope, Scope dephault) 103 { 104 return type.getScope(scope, dephault); 105 } 106 107 public static final boolean isValid(String scope) 108 { 109 return type.isValid(scope); 110 } 111 112 public static final int size() 113 { 114 return type.size(); 115 } 116 117 public static final String [] getScopes() 118 { 119 return type.getEnumNames(); 120 } 121 122 public static class Type extends Enum.Type 123 { 124 private Type() 125 { 126 super("scope", new Enum []{ 127 new Scope(0, REQUEST_STR), 128 new Scope(1, APPLICATION_STR), 129 new Scope(2, SESSION_STR) 130 }); 131 } 132 133 public final Scope getScope(int scope) 134 { 135 return (Scope)this.getEnum(scope); 136 } 137 138 public final Scope getScope(String scope) 139 { 140 return (Scope)this.getEnum(scope); 141 } 142 143 public final Scope getScope(String scope, Scope dephault) 144 { 145 return (Scope)this.getEnum(scope, dephault); 146 } 147 148 } 156 157 private Scope(int value, String name) 158 { 159 super(type, value, name); 160 } 161 } 162 163 ; 164 | Popular Tags |