Coverage Report - ca.uhn.hl7v2.hoh.api.MessageMetadataKeys
 
Classes in this File Line Coverage Branch Coverage Complexity
MessageMetadataKeys
100%
12/12
N/A
1
 
 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  175
 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  5
         REMOTE_HOST_ADDRESS(String.class),
 21  
         ;
 22  
         
 23  
         
 24  
         private static final Set<String> ourStringKeySetImm;
 25  
         
 26  
         static {
 27  5
                 HashSet<String> stringKeySet = new HashSet<String>();
 28  5
                 ourStringKeySetImm = Collections.unmodifiableSet(stringKeySet);
 29  10
                 for (MessageMetadataKeys next : values()) {
 30  5
                         stringKeySet.add(next.name());
 31  
                 }
 32  5
         }
 33  
         
 34  
         private Class<?> myValueType;
 35  
 
 36  5
         MessageMetadataKeys(Class<?> theValueType) {
 37  5
                 myValueType = theValueType;
 38  5
         }
 39  
 
 40  
         /**
 41  
          * @return The type for the value which is associated with this key
 42  
          */
 43  
         public Class<?> getValueType() {
 44  160
                 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  160
                 return ourStringKeySetImm;
 53  
         }
 54  
         
 55  
 }