001    package de.deepamehta.plugins.mail;
002    
003    import java.util.HashMap;
004    import java.util.Map;
005    
006    /**
007     * Switchable recipient type enumeration mapping.
008     */
009    public enum RecipientType {
010    
011        BCC("dm4.mail.recipient.bcc"), CC("dm4.mail.recipient.cc"), TO("dm4.mail.recipient.to");
012    
013        private static final Map<String, RecipientType> typesByUri = new HashMap<String, RecipientType>();
014    
015        static {
016            for (RecipientType type : RecipientType.values()) {
017                typesByUri.put(type.getUri(), type);
018            }
019        }
020    
021        private final String uri;
022    
023        private RecipientType(String uri) {
024            this.uri = uri;
025        }
026    
027        public String getUri() {
028            return uri;
029        }
030    
031        public static RecipientType fromUri(String uri) {
032            return typesByUri.get(uri);
033        }
034    }