Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Configuration.java
1 package org.bukkit.configuration;
2 
3 import java.util.Map;
4 
5 /**
6  * Represents a source of configurable options and settings
7  */
8 public interface Configuration extends ConfigurationSection {
9  /**
10  * Sets the default value of the given path as provided.
11  * <p>
12  * If no source {@link Configuration} was provided as a default
13  * collection, then a new {@link MemoryConfiguration} will be created to
14  * hold the new default value.
15  * <p>
16  * If value is null, the value will be removed from the default
17  * Configuration source.
18  *
19  * @param path Path of the value to set.
20  * @param value Value to set the default to.
21  * @throws IllegalArgumentException Thrown if path is null.
22  */
23  public void addDefault(String path, Object value);
24 
25  /**
26  * Sets the default values of the given paths as provided.
27  * <p>
28  * If no source {@link Configuration} was provided as a default
29  * collection, then a new {@link MemoryConfiguration} will be created to
30  * hold the new default values.
31  *
32  * @param defaults A map of Path->Values to add to defaults.
33  * @throws IllegalArgumentException Thrown if defaults is null.
34  */
35  public void addDefaults(Map<String, Object> defaults);
36 
37  /**
38  * Sets the default values of the given paths as provided.
39  * <p>
40  * If no source {@link Configuration} was provided as a default
41  * collection, then a new {@link MemoryConfiguration} will be created to
42  * hold the new default value.
43  * <p>
44  * This method will not hold a reference to the specified Configuration,
45  * nor will it automatically update if that Configuration ever changes. If
46  * you require this, you should set the default source with {@link
47  * #setDefaults(org.bukkit.configuration.Configuration)}.
48  *
49  * @param defaults A configuration holding a list of defaults to copy.
50  * @throws IllegalArgumentException Thrown if defaults is null or this.
51  */
52  public void addDefaults(Configuration defaults);
53 
54  /**
55  * Sets the source of all default values for this {@link Configuration}.
56  * <p>
57  * If a previous source was set, or previous default values were defined,
58  * then they will not be copied to the new source.
59  *
60  * @param defaults New source of default values for this configuration.
61  * @throws IllegalArgumentException Thrown if defaults is null or this.
62  */
63  public void setDefaults(Configuration defaults);
64 
65  /**
66  * Gets the source {@link Configuration} for this configuration.
67  * <p>
68  * If no configuration source was set, but default values were added, then
69  * a {@link MemoryConfiguration} will be returned. If no source was set
70  * and no defaults were set, then this method will return null.
71  *
72  * @return Configuration source for default values, or null if none exist.
73  */
74  public Configuration getDefaults();
75 
76  /**
77  * Gets the {@link ConfigurationOptions} for this {@link Configuration}.
78  * <p>
79  * All setters through this method are chainable.
80  *
81  * @return Options for this configuration
82  */
84 }
void setDefaults(Configuration defaults)
void addDefault(String path, Object value)
void addDefaults(Map< String, Object > defaults)