Configuration implements Iterable<Map.Entry<String,String>>,
                                      Writable { public void setPattern(String name, Pattern pattern) { assert pattern != null : "Pattern cannot be null"; set(name, pattern.pattern()); } Configuration();  Configuration(boolean loadDefaults); @SuppressWarnings("unchecked")  Configuration(Configuration other); static void addDeprecations(DeprecationDelta[] deltas); @Deprecated static void addDeprecation(String key, String[] newKeys,
      String customMessage); static void addDeprecation(String key, String newKey,
	      String customMessage); @Deprecated static void addDeprecation(String key, String[] newKeys); static void addDeprecation(String key, String newKey); static boolean isDeprecated(String key); void setDeprecatedProperties(); static synchronized void reloadExistingConfigurations(); static synchronized void addDefaultResource(String name); static void setRestrictSystemPropertiesDefault(boolean val); void setRestrictSystemProperties(boolean val); void addResource(String name); void addResource(String name, boolean restrictedParser); void addResource(URL url); void addResource(URL url, boolean restrictedParser); void addResource(Path file); void addResource(Path file, boolean restrictedParser); void addResource(InputStream in); void addResource(InputStream in, boolean restrictedParser); void addResource(InputStream in, String name); void addResource(InputStream in, String name,
      boolean restrictedParser); void addResource(Configuration conf); synchronized void reloadConfiguration(); String get(String name); @VisibleForTesting void setAllowNullValueProperties( boolean val ); void setRestrictSystemProps(boolean val); @VisibleForTesting boolean onlyKeyExists(String name); String getTrimmed(String name); String getTrimmed(String name, String defaultValue); String getRaw(String name); void set(String name, String value); void set(String name, String value, String source); synchronized void unset(String name); synchronized void setIfUnset(String name, String value); String get(String name, String defaultValue); int getInt(String name, int defaultValue); int[] getInts(String name); void setInt(String name, int value); long getLong(String name, long defaultValue); long getLongBytes(String name, long defaultValue); void setLong(String name, long value); float getFloat(String name, float defaultValue); void setFloat(String name, float value); double getDouble(String name, double defaultValue); void setDouble(String name, double value); boolean getBoolean(String name, boolean defaultValue); void setBoolean(String name, boolean value); void setBooleanIfUnset(String name, boolean value); void setEnum(String name, T value); T getEnum(String name, T defaultValue); void setTimeDuration(String name, long value, TimeUnit unit); long getTimeDuration(String name, long defaultValue, TimeUnit unit); long getTimeDuration(String name, String defaultValue, TimeUnit unit); long getTimeDurationHelper(String name, String vStr, TimeUnit unit); long[] getTimeDurations(String name, TimeUnit unit); double getStorageSize(String name, String defaultValue,
      StorageUnit targetUnit); double getStorageSize(String name, double defaultValue,
      StorageUnit targetUnit); void setStorageSize(String name, double value, StorageUnit unit); Pattern getPattern(String name, Pattern defaultValue); void setPattern(String name, Pattern pattern); @InterfaceStability.Unstable synchronized String[] getPropertySources(String name); IntegerRanges getRange(String name, String defaultValue); Collection<String> getStringCollection(String name); String[] getStrings(String name); String[] getStrings(String name, String... defaultValue); Collection<String> getTrimmedStringCollection(String name); String[] getTrimmedStrings(String name); String[] getTrimmedStrings(String name, String... defaultValue); void setStrings(String name, String... values); char[] getPassword(String name); char[] getPasswordFromCredentialProviders(String name); InetSocketAddress getSocketAddr(
      String hostProperty,
      String addressProperty,
      String defaultAddressValue,
      int defaultPort); InetSocketAddress getSocketAddr(
      String name, String defaultAddress, int defaultPort); void setSocketAddr(String name, InetSocketAddress addr); InetSocketAddress updateConnectAddr(
      String hostProperty,
      String addressProperty,
      String defaultAddressValue,
      InetSocketAddress addr); InetSocketAddress updateConnectAddr(String name,
                                             InetSocketAddress addr); Class<?> getClassByName(String name); Class<?> getClassByNameOrNull(String name); Class<?>[] getClasses(String name, Class<?> ... defaultValue); Class<?> getClass(String name, Class<?> defaultValue); Class<? extends U> getClass(String name, 
                                         Class<? extends U> defaultValue, 
                                         Class<U> xface); @SuppressWarnings("unchecked") List<U> getInstances(String name, Class<U> xface); void setClass(String name, Class<?> theClass, Class<?> xface); Path getLocalPath(String dirsProp, String path); File getFile(String dirsProp, String path); URL getResource(String name); InputStream getConfResourceAsInputStream(String name); Reader getConfResourceAsReader(String name); Set<String> getFinalParameters(); int size(); void clear(); @Override Iterator<Map.Entry<String, String>> iterator(); Map<String, String> getPropsWithPrefix(String confPrefix); void addTags(Properties prop); void writeXml(OutputStream out); void writeXml(Writer out); void writeXml(String propertyName, Writer out); static void dumpConfiguration(Configuration config,
      String propertyName, Writer out); static void dumpConfiguration(Configuration config,
      Writer out); ClassLoader getClassLoader(); void setClassLoader(ClassLoader classLoader); @Override String toString(); synchronized void setQuietMode(boolean quietmode); static void main(String[] args); @Override void readFields(DataInput in); @Override void write(DataOutput out); Map<String,String> getValByRegex(String regex); static void dumpDeprecatedKeys(); static boolean hasWarnedDeprecation(String name); Properties getAllPropertiesByTag(final String tag); Properties getAllPropertiesByTags(final List<String> tagList); boolean isPropertyTag(String tagStr);  }
@Test public void testSetPattern() { Pattern testPattern = Pattern.compile("a+b"); Configuration configuration = new Configuration(); configuration.setPattern("testPattern", testPattern); assertEquals(testPattern.pattern(), configuration.getPattern("testPattern", Pattern.compile("")).pattern()); }