Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.configuration.MemoryConfiguration Class Reference
Inheritance diagram for org.bukkit.configuration.MemoryConfiguration:
org.bukkit.configuration.MemorySection org.bukkit.configuration.Configuration org.bukkit.configuration.ConfigurationSection org.bukkit.configuration.ConfigurationSection org.bukkit.configuration.file.FileConfiguration org.bukkit.configuration.file.YamlConfiguration

Public Member Functions

 MemoryConfiguration ()
 
 MemoryConfiguration (Configuration defaults)
 
void addDefault (String path, Object value)
 
void addDefaults (Map< String, Object > defaults)
 
void addDefaults (Configuration defaults)
 
void setDefaults (Configuration defaults)
 
Configuration getDefaults ()
 
ConfigurationSection getParent ()
 
MemoryConfigurationOptions options ()
 
- Public Member Functions inherited from org.bukkit.configuration.MemorySection
Set< String > getKeys (boolean deep)
 
Map< String, Object > getValues (boolean deep)
 
boolean contains (String path)
 
boolean isSet (String path)
 
String getCurrentPath ()
 
String getName ()
 
Configuration getRoot ()
 
ConfigurationSection getParent ()
 
void addDefault (String path, Object value)
 
ConfigurationSection getDefaultSection ()
 
void set (String path, Object value)
 
Object get (String path)
 
Object get (String path, Object def)
 
ConfigurationSection createSection (String path)
 
ConfigurationSection createSection (String path, Map<?,?> map)
 
String getString (String path)
 
String getString (String path, String def)
 
boolean isString (String path)
 
int getInt (String path)
 
int getInt (String path, int def)
 
boolean isInt (String path)
 
boolean getBoolean (String path)
 
boolean getBoolean (String path, boolean def)
 
boolean isBoolean (String path)
 
double getDouble (String path)
 
double getDouble (String path, double def)
 
boolean isDouble (String path)
 
long getLong (String path)
 
long getLong (String path, long def)
 
boolean isLong (String path)
 
List<?> getList (String path)
 
List<?> getList (String path, List<?> def)
 
boolean isList (String path)
 
List< String > getStringList (String path)
 
List< Integer > getIntegerList (String path)
 
List< Boolean > getBooleanList (String path)
 
List< Double > getDoubleList (String path)
 
List< Float > getFloatList (String path)
 
List< Long > getLongList (String path)
 
List< Byte > getByteList (String path)
 
List< Character > getCharacterList (String path)
 
List< Short > getShortList (String path)
 
List< Map<?,?> > getMapList (String path)
 
Vector getVector (String path)
 
Vector getVector (String path, Vector def)
 
boolean isVector (String path)
 
OfflinePlayer getOfflinePlayer (String path)
 
OfflinePlayer getOfflinePlayer (String path, OfflinePlayer def)
 
boolean isOfflinePlayer (String path)
 
ItemStack getItemStack (String path)
 
ItemStack getItemStack (String path, ItemStack def)
 
boolean isItemStack (String path)
 
Color getColor (String path)
 
Color getColor (String path, Color def)
 
boolean isColor (String path)
 
ConfigurationSection getConfigurationSection (String path)
 
boolean isConfigurationSection (String path)
 
String toString ()
 

Protected Attributes

Configuration defaults
 
MemoryConfigurationOptions options
 
- Protected Attributes inherited from org.bukkit.configuration.MemorySection
final Map< String, Object > map = new LinkedHashMap<String, Object>()
 

Additional Inherited Members

- Static Public Member Functions inherited from org.bukkit.configuration.MemorySection
static String createPath (ConfigurationSection section, String key)
 
static String createPath (ConfigurationSection section, String key, ConfigurationSection relativeTo)
 
- Protected Member Functions inherited from org.bukkit.configuration.MemorySection
 MemorySection ()
 
 MemorySection (ConfigurationSection parent, String path)
 
boolean isPrimitiveWrapper (Object input)
 
Object getDefault (String path)
 
void mapChildrenKeys (Set< String > output, ConfigurationSection section, boolean deep)
 
void mapChildrenValues (Map< String, Object > output, ConfigurationSection section, boolean deep)
 

Detailed Description

This is a Configuration implementation that does not save or load from any source, and stores all values in memory only. This is useful for temporary Configurations for providing defaults.

Definition at line 12 of file MemoryConfiguration.java.

Constructor & Destructor Documentation

org.bukkit.configuration.MemoryConfiguration.MemoryConfiguration ( )

Creates an empty MemoryConfiguration with no default values.

Definition at line 19 of file MemoryConfiguration.java.

Referenced by org.bukkit.configuration.MemoryConfiguration.addDefault().

19 {}
org.bukkit.configuration.MemoryConfiguration.MemoryConfiguration ( Configuration  defaults)

Creates an empty MemoryConfiguration using the specified Configuration as a source for all default values.

Parameters
defaultsDefault value provider
Exceptions
IllegalArgumentExceptionThrown if defaults is null

Definition at line 28 of file MemoryConfiguration.java.

28  {
29  this.defaults = defaults;
30  }

Member Function Documentation

void org.bukkit.configuration.MemoryConfiguration.addDefault ( String  path,
Object  value 
)

Sets the default value of the given path as provided.

If no source Configuration was provided as a default collection, then a new MemoryConfiguration will be created to hold the new default value.

If value is null, the value will be removed from the default Configuration source.

Parameters
pathPath of the value to set.
valueValue to set the default to.
Exceptions
IllegalArgumentExceptionThrown if path is null.

Implements org.bukkit.configuration.Configuration.

Definition at line 33 of file MemoryConfiguration.java.

References org.bukkit.configuration.MemoryConfiguration.MemoryConfiguration(), and org.bukkit.configuration.ConfigurationSection.set().

Referenced by org.bukkit.configuration.MemoryConfiguration.addDefaults().

33  {
34  Validate.notNull(path, "Path may not be null");
35 
36  if (defaults == null) {
37  defaults = new MemoryConfiguration();
38  }
39 
40  defaults.set(path, value);
41  }
void set(String path, Object value)
void org.bukkit.configuration.MemoryConfiguration.addDefaults ( Map< String, Object >  defaults)

Sets the default values of the given paths as provided.

If no source Configuration was provided as a default collection, then a new MemoryConfiguration will be created to hold the new default values.

Parameters
defaultsA map of Path->Values to add to defaults.
Exceptions
IllegalArgumentExceptionThrown if defaults is null.

Implements org.bukkit.configuration.Configuration.

Definition at line 43 of file MemoryConfiguration.java.

References org.bukkit.configuration.MemoryConfiguration.addDefault().

Referenced by org.bukkit.configuration.MemoryConfiguration.addDefaults().

43  {
44  Validate.notNull(defaults, "Defaults may not be null");
45 
46  for (Map.Entry<String, Object> entry : defaults.entrySet()) {
47  addDefault(entry.getKey(), entry.getValue());
48  }
49  }
void org.bukkit.configuration.MemoryConfiguration.addDefaults ( Configuration  defaults)

Sets the default values of the given paths as provided.

If no source Configuration was provided as a default collection, then a new MemoryConfiguration will be created to hold the new default value.

This method will not hold a reference to the specified Configuration, nor will it automatically update if that Configuration ever changes. If you require this, you should set the default source with setDefaults(org.bukkit.configuration.Configuration).

Parameters
defaultsA configuration holding a list of defaults to copy.
Exceptions
IllegalArgumentExceptionThrown if defaults is null or this.

Implements org.bukkit.configuration.Configuration.

Definition at line 51 of file MemoryConfiguration.java.

References org.bukkit.configuration.MemoryConfiguration.addDefaults(), and org.bukkit.configuration.ConfigurationSection.getValues().

51  {
52  Validate.notNull(defaults, "Defaults may not be null");
53 
54  addDefaults(defaults.getValues(true));
55  }
Map< String, Object > getValues(boolean deep)
void addDefaults(Map< String, Object > defaults)
Configuration org.bukkit.configuration.MemoryConfiguration.getDefaults ( )

Gets the source Configuration for this configuration.

If no configuration source was set, but default values were added, then a MemoryConfiguration will be returned. If no source was set and no defaults were set, then this method will return null.

Returns
Configuration source for default values, or null if none exist.

Implements org.bukkit.configuration.Configuration.

Definition at line 63 of file MemoryConfiguration.java.

63  {
64  return defaults;
65  }
ConfigurationSection org.bukkit.configuration.MemoryConfiguration.getParent ( )

Gets the parent ConfigurationSection that directly contains this ConfigurationSection.

For any Configuration themselves, this will return null.

If the section is no longer contained within its parent for any reason, such as being replaced with a different value, this may return null.

Returns
Parent section containing this section.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 68 of file MemoryConfiguration.java.

68  {
69  return null;
70  }
MemoryConfigurationOptions org.bukkit.configuration.MemoryConfiguration.options ( )

Gets the ConfigurationOptions for this Configuration.

All setters through this method are chainable.

Returns
Options for this configuration

Implements org.bukkit.configuration.Configuration.

Definition at line 72 of file MemoryConfiguration.java.

72  {
73  if (options == null) {
74  options = new MemoryConfigurationOptions(this);
75  }
76 
77  return options;
78  }
void org.bukkit.configuration.MemoryConfiguration.setDefaults ( Configuration  defaults)

Sets the source of all default values for this Configuration.

If a previous source was set, or previous default values were defined, then they will not be copied to the new source.

Parameters
defaultsNew source of default values for this configuration.
Exceptions
IllegalArgumentExceptionThrown if defaults is null or this.

Implements org.bukkit.configuration.Configuration.

Definition at line 57 of file MemoryConfiguration.java.

Referenced by org.bukkit.plugin.java.JavaPlugin.reloadConfig().

57  {
58  Validate.notNull(defaults, "Defaults may not be null");
59 
60  this.defaults = defaults;
61  }

The documentation for this class was generated from the following file: