View Javadoc

1   /*
2    * Copyright 2008 Simon Martinelli, Rebenweg 32, 3236 Gampelen, Switzerland
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  package org.simject.util;
17  
18  /**
19   * Enumeration containing the available protocol types
20   * 
21   * @author Simon Martinelli
22   */
23  public enum Protocol {
24  
25  	Xml("xml", "text/xml"), Binary("bin",
26  			"application/x-java-serialized-object");
27  
28  	/**
29  	 * Holds the name of the protocol
30  	 */
31  	private String string;
32  
33  	/**
34  	 * Holds the content type
35  	 */
36  	private String contentType;
37  
38  	/**
39  	 * Constructor taking the name and the content type
40  	 * 
41  	 * @param string
42  	 * @param contentType
43  	 */
44  	private Protocol(final String string, final String contentType) {
45  		this.string = string;
46  		this.contentType = contentType;
47  	}
48  
49  	/**
50  	 * Returns the protocol as string
51  	 * 
52  	 * @return
53  	 */
54  	public String getString() {
55  		return this.string;
56  	}
57  
58  	/**
59  	 * Returns the content typ of the protcol
60  	 * 
61  	 * @return
62  	 */
63  	public String getContentType() {
64  		return this.contentType;
65  	}
66  }