View Javadoc

1   package ca.uhn.hl7v2.hoh.api;
2   
3   import java.util.Collections;
4   import java.util.HashSet;
5   import java.util.Set;
6   
7   /**
8    * Enum containing keys for message metadata
9    */
10  public enum MessageMetadataKeys {
11  
12  	
13  	
14  	/**
15  	 * The host address from which the message was sent. Value
16  	 * will be a {@link String} containing a raw IP address.
17  	 * 
18  	 *  @see javax.servlet.http.HttpServletRequest#getRemoteAddr()
19  	 */
20  	REMOTE_HOST_ADDRESS(String.class),
21  	;
22  	
23  	
24  	private static final Set<String> ourStringKeySetImm;
25  	
26  	static {
27  		HashSet<String> stringKeySet = new HashSet<String>();
28  		ourStringKeySetImm = Collections.unmodifiableSet(stringKeySet);
29  		for (MessageMetadataKeys next : values()) {
30  			stringKeySet.add(next.name());
31  		}
32  	}
33  	
34  	private Class<?> myValueType;
35  
36  	MessageMetadataKeys(Class<?> theValueType) {
37  		myValueType = theValueType;
38  	}
39  
40  	/**
41  	 * @return The type for the value which is associated with this key
42  	 */
43  	public Class<?> getValueType() {
44  		return myValueType;
45  	}
46  
47  	/**
48  	 * @return Returns a set containing the string equivalent to all
49  	 * entries in the map
50  	 */
51  	public static Set<String> keyStringSet() {
52  		return ourStringKeySetImm;
53  	}
54  	
55  }