001package co.codewizards.cloudstore.local; 002 003import static java.util.Objects.*; 004 005public enum PersistencePropertiesEnum { 006 CONNECTION_DRIVER_NAME("javax.jdo.option.ConnectionDriverName"), 007 008 CONNECTION_URL("javax.jdo.option.ConnectionURL"), 009 010// /** 011// * The connection-URL is modified, if the DB needs to be created. This property keeps 012// * the original connection-URL. However, this URL, too, is resolved (i.e. variables 013// * are replaced by values). 014// */ 015// CONNECTION_URL_ORIGINAL("_ORIGINAL_javax.jdo.option.ConnectionURL"), 016 017 CONNECTION_USER_NAME("javax.jdo.option.ConnectionUserName"), 018 019 CONNECTION_PASSWORD("javax.jdo.option.ConnectionPassword") 020 ; 021 022 public final String key; 023 024 private PersistencePropertiesEnum(String key) { 025 this.key = requireNonNull(key, "key"); 026 } 027 028 @Override 029 public String toString() { 030 return key; 031 } 032 033 public static PersistencePropertiesEnum fromKey(String key) { 034 for (PersistencePropertiesEnum e : values()) { 035 if (e.key.equals(key)) 036 return e; 037 } 038 throw new IllegalArgumentException("There is no PersistencePropertiesEnum value for this key: " + key); 039 } 040}