1 /*******************************************************************************
2 * Copyright (c) 2011 Michael Mimo Moratti.
3 *
4 * Michael Mimo Moratti licenses this file to you under the Apache License, version 2.0
5 * (the "License"); you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 * License for the specific language governing permissions and limitations
12 * under the License.
13 *******************************************************************************/
14 package ch.mimo.netty.handler.codec.icap;
15
16 /**
17 * This enum contains all valid ICAP message element names that can occur in
18 * an @see {@link Encapsulated} header.
19 *
20 * @author Michael Mimo Moratti (mimo@mimo.ch)
21 *
22 */
23 public enum IcapMessageElementEnum {
24 REQHDR(IcapCodecUtil.ENCAPSULATION_ELEMENT_REQHDR),
25 RESHDR(IcapCodecUtil.ENCAPSULATION_ELEMENT_RESHDR),
26 REQBODY(IcapCodecUtil.ENCAPSULATION_ELEMENT_REQBODY),
27 RESBODY(IcapCodecUtil.ENCAPSULATION_ELEMENT_RESBODY),
28 OPTBODY(IcapCodecUtil.ENCAPSULATION_ELEMENT_OPTBODY),
29 NULLBODY(IcapCodecUtil.ENCAPSULATION_ELEMENT_NULLBODY);
30
31 private String value;
32
33 IcapMessageElementEnum(String value) {
34 this.value = value;
35 }
36
37 public String getValue() {
38 return value;
39 }
40
41 public static IcapMessageElementEnum fromString(String value) {
42 if(value != null) {
43 for(IcapMessageElementEnum entryName : IcapMessageElementEnum.values()) {
44 if(value.equalsIgnoreCase(entryName.getValue())) {
45 return entryName;
46 }
47 }
48 }
49 return null;
50 }
51 }