001package ca.uhn.hl7v2.hoh.api; 002 003import java.util.Collections; 004import java.util.HashSet; 005import java.util.Set; 006 007/** 008 * Enum containing keys for message metadata 009 */ 010public enum MessageMetadataKeys { 011 012 013 014 /** 015 * The host address from which the message was sent. Value 016 * will be a {@link String} containing a raw IP address. 017 * 018 * @see javax.servlet.http.HttpServletRequest#getRemoteAddr() 019 */ 020 REMOTE_HOST_ADDRESS(String.class), 021 ; 022 023 024 private static final Set<String> ourStringKeySetImm; 025 026 static { 027 HashSet<String> stringKeySet = new HashSet<String>(); 028 ourStringKeySetImm = Collections.unmodifiableSet(stringKeySet); 029 for (MessageMetadataKeys next : values()) { 030 stringKeySet.add(next.name()); 031 } 032 } 033 034 private Class<?> myValueType; 035 036 MessageMetadataKeys(Class<?> theValueType) { 037 myValueType = theValueType; 038 } 039 040 /** 041 * @return The type for the value which is associated with this key 042 */ 043 public Class<?> getValueType() { 044 return myValueType; 045 } 046 047 /** 048 * @return Returns a set containing the string equivalent to all 049 * entries in the map 050 */ 051 public static Set<String> keyStringSet() { 052 return ourStringKeySetImm; 053 } 054 055}