001 package org.bukkit.configuration; 002 003 import java.util.Map; 004 import java.util.Set; 005 import java.util.List; 006 007 import org.bukkit.Color; 008 import org.bukkit.OfflinePlayer; 009 import org.bukkit.util.Vector; 010 import org.bukkit.inventory.ItemStack; 011 012 /** 013 * Represents a section of a {@link Configuration} 014 */ 015 public interface ConfigurationSection { 016 /** 017 * Gets a set containing all keys in this section. 018 * <p> 019 * If deep is set to true, then this will contain all the keys within any 020 * child {@link ConfigurationSection}s (and their children, etc). These 021 * will be in a valid path notation for you to use. 022 * <p> 023 * If deep is set to false, then this will contain only the keys of any 024 * direct children, and not their own children. 025 * 026 * @param deep Whether or not to get a deep list, as opposed to a shallow 027 * list. 028 * @return Set of keys contained within this ConfigurationSection. 029 */ 030 public Set<String> getKeys(boolean deep); 031 032 /** 033 * Gets a Map containing all keys and their values for this section. 034 * <p> 035 * If deep is set to true, then this will contain all the keys and values 036 * within any child {@link ConfigurationSection}s (and their children, 037 * etc). These keys will be in a valid path notation for you to use. 038 * <p> 039 * If deep is set to false, then this will contain only the keys and 040 * values of any direct children, and not their own children. 041 * 042 * @param deep Whether or not to get a deep list, as opposed to a shallow 043 * list. 044 * @return Map of keys and values of this section. 045 */ 046 public Map<String, Object> getValues(boolean deep); 047 048 /** 049 * Checks if this {@link ConfigurationSection} contains the given path. 050 * <p> 051 * If the value for the requested path does not exist but a default value 052 * has been specified, this will return true. 053 * 054 * @param path Path to check for existence. 055 * @return True if this section contains the requested path, either via 056 * default or being set. 057 * @throws IllegalArgumentException Thrown when path is null. 058 */ 059 public boolean contains(String path); 060 061 /** 062 * Checks if this {@link ConfigurationSection} has a value set for the 063 * given path. 064 * <p> 065 * If the value for the requested path does not exist but a default value 066 * has been specified, this will still return false. 067 * 068 * @param path Path to check for existence. 069 * @return True if this section contains the requested path, regardless of 070 * having a default. 071 * @throws IllegalArgumentException Thrown when path is null. 072 */ 073 public boolean isSet(String path); 074 075 /** 076 * Gets the path of this {@link ConfigurationSection} from its root {@link 077 * Configuration} 078 * <p> 079 * For any {@link Configuration} themselves, this will return an empty 080 * string. 081 * <p> 082 * If the section is no longer contained within its root for any reason, 083 * such as being replaced with a different value, this may return null. 084 * <p> 085 * To retrieve the single name of this section, that is, the final part of 086 * the path returned by this method, you may use {@link #getName()}. 087 * 088 * @return Path of this section relative to its root 089 */ 090 public String getCurrentPath(); 091 092 /** 093 * Gets the name of this individual {@link ConfigurationSection}, in the 094 * path. 095 * <p> 096 * This will always be the final part of {@link #getCurrentPath()}, unless 097 * the section is orphaned. 098 * 099 * @return Name of this section 100 */ 101 public String getName(); 102 103 /** 104 * Gets the root {@link Configuration} that contains this {@link 105 * ConfigurationSection} 106 * <p> 107 * For any {@link Configuration} themselves, this will return its own 108 * object. 109 * <p> 110 * If the section is no longer contained within its root for any reason, 111 * such as being replaced with a different value, this may return null. 112 * 113 * @return Root configuration containing this section. 114 */ 115 public Configuration getRoot(); 116 117 /** 118 * Gets the parent {@link ConfigurationSection} that directly contains 119 * this {@link ConfigurationSection}. 120 * <p> 121 * For any {@link Configuration} themselves, this will return null. 122 * <p> 123 * If the section is no longer contained within its parent for any reason, 124 * such as being replaced with a different value, this may return null. 125 * 126 * @return Parent section containing this section. 127 */ 128 public ConfigurationSection getParent(); 129 130 /** 131 * Gets the requested Object by path. 132 * <p> 133 * If the Object does not exist but a default value has been specified, 134 * this will return the default value. If the Object does not exist and no 135 * default value was specified, this will return null. 136 * 137 * @param path Path of the Object to get. 138 * @return Requested Object. 139 */ 140 public Object get(String path); 141 142 /** 143 * Gets the requested Object by path, returning a default value if not 144 * found. 145 * <p> 146 * If the Object does not exist then the specified default value will 147 * returned regardless of if a default has been identified in the root 148 * {@link Configuration}. 149 * 150 * @param path Path of the Object to get. 151 * @param def The default value to return if the path is not found. 152 * @return Requested Object. 153 */ 154 public Object get(String path, Object def); 155 156 /** 157 * Sets the specified path to the given value. 158 * <p> 159 * If value is null, the entry will be removed. Any existing entry will be 160 * replaced, regardless of what the new value is. 161 * <p> 162 * Some implementations may have limitations on what you may store. See 163 * their individual javadocs for details. No implementations should allow 164 * you to store {@link Configuration}s or {@link ConfigurationSection}s, 165 * please use {@link #createSection(java.lang.String)} for that. 166 * 167 * @param path Path of the object to set. 168 * @param value New value to set the path to. 169 */ 170 public void set(String path, Object value); 171 172 /** 173 * Creates an empty {@link ConfigurationSection} at the specified path. 174 * <p> 175 * Any value that was previously set at this path will be overwritten. If 176 * the previous value was itself a {@link ConfigurationSection}, it will 177 * be orphaned. 178 * 179 * @param path Path to create the section at. 180 * @return Newly created section 181 */ 182 public ConfigurationSection createSection(String path); 183 184 /** 185 * Creates a {@link ConfigurationSection} at the specified path, with 186 * specified values. 187 * <p> 188 * Any value that was previously set at this path will be overwritten. If 189 * the previous value was itself a {@link ConfigurationSection}, it will 190 * be orphaned. 191 * 192 * @param path Path to create the section at. 193 * @param map The values to used. 194 * @return Newly created section 195 */ 196 public ConfigurationSection createSection(String path, Map<?, ?> map); 197 198 // Primitives 199 /** 200 * Gets the requested String by path. 201 * <p> 202 * If the String does not exist but a default value has been specified, 203 * this will return the default value. If the String does not exist and no 204 * default value was specified, this will return null. 205 * 206 * @param path Path of the String to get. 207 * @return Requested String. 208 */ 209 public String getString(String path); 210 211 /** 212 * Gets the requested String by path, returning a default value if not 213 * found. 214 * <p> 215 * If the String does not exist then the specified default value will 216 * returned regardless of if a default has been identified in the root 217 * {@link Configuration}. 218 * 219 * @param path Path of the String to get. 220 * @param def The default value to return if the path is not found or is 221 * not a String. 222 * @return Requested String. 223 */ 224 public String getString(String path, String def); 225 226 /** 227 * Checks if the specified path is a String. 228 * <p> 229 * If the path exists but is not a String, this will return false. If the 230 * path does not exist, this will return false. If the path does not exist 231 * but a default value has been specified, this will check if that default 232 * value is a String and return appropriately. 233 * 234 * @param path Path of the String to check. 235 * @return Whether or not the specified path is a String. 236 */ 237 public boolean isString(String path); 238 239 /** 240 * Gets the requested int by path. 241 * <p> 242 * If the int does not exist but a default value has been specified, this 243 * will return the default value. If the int does not exist and no default 244 * value was specified, this will return 0. 245 * 246 * @param path Path of the int to get. 247 * @return Requested int. 248 */ 249 public int getInt(String path); 250 251 /** 252 * Gets the requested int by path, returning a default value if not found. 253 * <p> 254 * If the int does not exist then the specified default value will 255 * returned regardless of if a default has been identified in the root 256 * {@link Configuration}. 257 * 258 * @param path Path of the int to get. 259 * @param def The default value to return if the path is not found or is 260 * not an int. 261 * @return Requested int. 262 */ 263 public int getInt(String path, int def); 264 265 /** 266 * Checks if the specified path is an int. 267 * <p> 268 * If the path exists but is not a int, this will return false. If the 269 * path does not exist, this will return false. If the path does not exist 270 * but a default value has been specified, this will check if that default 271 * value is a int and return appropriately. 272 * 273 * @param path Path of the int to check. 274 * @return Whether or not the specified path is an int. 275 */ 276 public boolean isInt(String path); 277 278 /** 279 * Gets the requested boolean by path. 280 * <p> 281 * If the boolean does not exist but a default value has been specified, 282 * this will return the default value. If the boolean does not exist and 283 * no default value was specified, this will return false. 284 * 285 * @param path Path of the boolean to get. 286 * @return Requested boolean. 287 */ 288 public boolean getBoolean(String path); 289 290 /** 291 * Gets the requested boolean by path, returning a default value if not 292 * found. 293 * <p> 294 * If the boolean does not exist then the specified default value will 295 * returned regardless of if a default has been identified in the root 296 * {@link Configuration}. 297 * 298 * @param path Path of the boolean to get. 299 * @param def The default value to return if the path is not found or is 300 * not a boolean. 301 * @return Requested boolean. 302 */ 303 public boolean getBoolean(String path, boolean def); 304 305 /** 306 * Checks if the specified path is a boolean. 307 * <p> 308 * If the path exists but is not a boolean, this will return false. If the 309 * path does not exist, this will return false. If the path does not exist 310 * but a default value has been specified, this will check if that default 311 * value is a boolean and return appropriately. 312 * 313 * @param path Path of the boolean to check. 314 * @return Whether or not the specified path is a boolean. 315 */ 316 public boolean isBoolean(String path); 317 318 /** 319 * Gets the requested double by path. 320 * <p> 321 * If the double does not exist but a default value has been specified, 322 * this will return the default value. If the double does not exist and no 323 * default value was specified, this will return 0. 324 * 325 * @param path Path of the double to get. 326 * @return Requested double. 327 */ 328 public double getDouble(String path); 329 330 /** 331 * Gets the requested double by path, returning a default value if not 332 * found. 333 * <p> 334 * If the double does not exist then the specified default value will 335 * returned regardless of if a default has been identified in the root 336 * {@link Configuration}. 337 * 338 * @param path Path of the double to get. 339 * @param def The default value to return if the path is not found or is 340 * not a double. 341 * @return Requested double. 342 */ 343 public double getDouble(String path, double def); 344 345 /** 346 * Checks if the specified path is a double. 347 * <p> 348 * If the path exists but is not a double, this will return false. If the 349 * path does not exist, this will return false. If the path does not exist 350 * but a default value has been specified, this will check if that default 351 * value is a double and return appropriately. 352 * 353 * @param path Path of the double to check. 354 * @return Whether or not the specified path is a double. 355 */ 356 public boolean isDouble(String path); 357 358 /** 359 * Gets the requested long by path. 360 * <p> 361 * If the long does not exist but a default value has been specified, this 362 * will return the default value. If the long does not exist and no 363 * default value was specified, this will return 0. 364 * 365 * @param path Path of the long to get. 366 * @return Requested long. 367 */ 368 public long getLong(String path); 369 370 /** 371 * Gets the requested long by path, returning a default value if not 372 * found. 373 * <p> 374 * If the long does not exist then the specified default value will 375 * returned regardless of if a default has been identified in the root 376 * {@link Configuration}. 377 * 378 * @param path Path of the long to get. 379 * @param def The default value to return if the path is not found or is 380 * not a long. 381 * @return Requested long. 382 */ 383 public long getLong(String path, long def); 384 385 /** 386 * Checks if the specified path is a long. 387 * <p> 388 * If the path exists but is not a long, this will return false. If the 389 * path does not exist, this will return false. If the path does not exist 390 * but a default value has been specified, this will check if that default 391 * value is a long and return appropriately. 392 * 393 * @param path Path of the long to check. 394 * @return Whether or not the specified path is a long. 395 */ 396 public boolean isLong(String path); 397 398 // Java 399 /** 400 * Gets the requested List by path. 401 * <p> 402 * If the List does not exist but a default value has been specified, this 403 * will return the default value. If the List does not exist and no 404 * default value was specified, this will return null. 405 * 406 * @param path Path of the List to get. 407 * @return Requested List. 408 */ 409 public List<?> getList(String path); 410 411 /** 412 * Gets the requested List by path, returning a default value if not 413 * found. 414 * <p> 415 * If the List does not exist then the specified default value will 416 * returned regardless of if a default has been identified in the root 417 * {@link Configuration}. 418 * 419 * @param path Path of the List to get. 420 * @param def The default value to return if the path is not found or is 421 * not a List. 422 * @return Requested List. 423 */ 424 public List<?> getList(String path, List<?> def); 425 426 /** 427 * Checks if the specified path is a List. 428 * <p> 429 * If the path exists but is not a List, this will return false. If the 430 * path does not exist, this will return false. If the path does not exist 431 * but a default value has been specified, this will check if that default 432 * value is a List and return appropriately. 433 * 434 * @param path Path of the List to check. 435 * @return Whether or not the specified path is a List. 436 */ 437 public boolean isList(String path); 438 439 /** 440 * Gets the requested List of String by path. 441 * <p> 442 * If the List does not exist but a default value has been specified, this 443 * will return the default value. If the List does not exist and no 444 * default value was specified, this will return an empty List. 445 * <p> 446 * This method will attempt to cast any values into a String if possible, 447 * but may miss any values out if they are not compatible. 448 * 449 * @param path Path of the List to get. 450 * @return Requested List of String. 451 */ 452 public List<String> getStringList(String path); 453 454 /** 455 * Gets the requested List of Integer by path. 456 * <p> 457 * If the List does not exist but a default value has been specified, this 458 * will return the default value. If the List does not exist and no 459 * default value was specified, this will return an empty List. 460 * <p> 461 * This method will attempt to cast any values into a Integer if possible, 462 * but may miss any values out if they are not compatible. 463 * 464 * @param path Path of the List to get. 465 * @return Requested List of Integer. 466 */ 467 public List<Integer> getIntegerList(String path); 468 469 /** 470 * Gets the requested List of Boolean by path. 471 * <p> 472 * If the List does not exist but a default value has been specified, this 473 * will return the default value. If the List does not exist and no 474 * default value was specified, this will return an empty List. 475 * <p> 476 * This method will attempt to cast any values into a Boolean if possible, 477 * but may miss any values out if they are not compatible. 478 * 479 * @param path Path of the List to get. 480 * @return Requested List of Boolean. 481 */ 482 public List<Boolean> getBooleanList(String path); 483 484 /** 485 * Gets the requested List of Double by path. 486 * <p> 487 * If the List does not exist but a default value has been specified, this 488 * will return the default value. If the List does not exist and no 489 * default value was specified, this will return an empty List. 490 * <p> 491 * This method will attempt to cast any values into a Double if possible, 492 * but may miss any values out if they are not compatible. 493 * 494 * @param path Path of the List to get. 495 * @return Requested List of Double. 496 */ 497 public List<Double> getDoubleList(String path); 498 499 /** 500 * Gets the requested List of Float by path. 501 * <p> 502 * If the List does not exist but a default value has been specified, this 503 * will return the default value. If the List does not exist and no 504 * default value was specified, this will return an empty List. 505 * <p> 506 * This method will attempt to cast any values into a Float if possible, 507 * but may miss any values out if they are not compatible. 508 * 509 * @param path Path of the List to get. 510 * @return Requested List of Float. 511 */ 512 public List<Float> getFloatList(String path); 513 514 /** 515 * Gets the requested List of Long by path. 516 * <p> 517 * If the List does not exist but a default value has been specified, this 518 * will return the default value. If the List does not exist and no 519 * default value was specified, this will return an empty List. 520 * <p> 521 * This method will attempt to cast any values into a Long if possible, 522 * but may miss any values out if they are not compatible. 523 * 524 * @param path Path of the List to get. 525 * @return Requested List of Long. 526 */ 527 public List<Long> getLongList(String path); 528 529 /** 530 * Gets the requested List of Byte by path. 531 * <p> 532 * If the List does not exist but a default value has been specified, this 533 * will return the default value. If the List does not exist and no 534 * default value was specified, this will return an empty List. 535 * <p> 536 * This method will attempt to cast any values into a Byte if possible, 537 * but may miss any values out if they are not compatible. 538 * 539 * @param path Path of the List to get. 540 * @return Requested List of Byte. 541 */ 542 public List<Byte> getByteList(String path); 543 544 /** 545 * Gets the requested List of Character by path. 546 * <p> 547 * If the List does not exist but a default value has been specified, this 548 * will return the default value. If the List does not exist and no 549 * default value was specified, this will return an empty List. 550 * <p> 551 * This method will attempt to cast any values into a Character if 552 * possible, but may miss any values out if they are not compatible. 553 * 554 * @param path Path of the List to get. 555 * @return Requested List of Character. 556 */ 557 public List<Character> getCharacterList(String path); 558 559 /** 560 * Gets the requested List of Short by path. 561 * <p> 562 * If the List does not exist but a default value has been specified, this 563 * will return the default value. If the List does not exist and no 564 * default value was specified, this will return an empty List. 565 * <p> 566 * This method will attempt to cast any values into a Short if possible, 567 * but may miss any values out if they are not compatible. 568 * 569 * @param path Path of the List to get. 570 * @return Requested List of Short. 571 */ 572 public List<Short> getShortList(String path); 573 574 /** 575 * Gets the requested List of Maps by path. 576 * <p> 577 * If the List does not exist but a default value has been specified, this 578 * will return the default value. If the List does not exist and no 579 * default value was specified, this will return an empty List. 580 * <p> 581 * This method will attempt to cast any values into a Map if possible, but 582 * may miss any values out if they are not compatible. 583 * 584 * @param path Path of the List to get. 585 * @return Requested List of Maps. 586 */ 587 public List<Map<?, ?>> getMapList(String path); 588 589 // Bukkit 590 /** 591 * Gets the requested Vector by path. 592 * <p> 593 * If the Vector does not exist but a default value has been specified, 594 * this will return the default value. If the Vector does not exist and no 595 * default value was specified, this will return null. 596 * 597 * @param path Path of the Vector to get. 598 * @return Requested Vector. 599 */ 600 public Vector getVector(String path); 601 602 /** 603 * Gets the requested {@link Vector} by path, returning a default value if 604 * not found. 605 * <p> 606 * If the Vector does not exist then the specified default value will 607 * returned regardless of if a default has been identified in the root 608 * {@link Configuration}. 609 * 610 * @param path Path of the Vector to get. 611 * @param def The default value to return if the path is not found or is 612 * not a Vector. 613 * @return Requested Vector. 614 */ 615 public Vector getVector(String path, Vector def); 616 617 /** 618 * Checks if the specified path is a Vector. 619 * <p> 620 * If the path exists but is not a Vector, this will return false. If the 621 * path does not exist, this will return false. If the path does not exist 622 * but a default value has been specified, this will check if that default 623 * value is a Vector and return appropriately. 624 * 625 * @param path Path of the Vector to check. 626 * @return Whether or not the specified path is a Vector. 627 */ 628 public boolean isVector(String path); 629 630 /** 631 * Gets the requested OfflinePlayer by path. 632 * <p> 633 * If the OfflinePlayer does not exist but a default value has been 634 * specified, this will return the default value. If the OfflinePlayer 635 * does not exist and no default value was specified, this will return 636 * null. 637 * 638 * @param path Path of the OfflinePlayer to get. 639 * @return Requested OfflinePlayer. 640 */ 641 public OfflinePlayer getOfflinePlayer(String path); 642 643 /** 644 * Gets the requested {@link OfflinePlayer} by path, returning a default 645 * value if not found. 646 * <p> 647 * If the OfflinePlayer does not exist then the specified default value 648 * will returned regardless of if a default has been identified in the 649 * root {@link Configuration}. 650 * 651 * @param path Path of the OfflinePlayer to get. 652 * @param def The default value to return if the path is not found or is 653 * not an OfflinePlayer. 654 * @return Requested OfflinePlayer. 655 */ 656 public OfflinePlayer getOfflinePlayer(String path, OfflinePlayer def); 657 658 /** 659 * Checks if the specified path is an OfflinePlayer. 660 * <p> 661 * If the path exists but is not a OfflinePlayer, this will return false. 662 * If the path does not exist, this will return false. If the path does 663 * not exist but a default value has been specified, this will check if 664 * that default value is a OfflinePlayer and return appropriately. 665 * 666 * @param path Path of the OfflinePlayer to check. 667 * @return Whether or not the specified path is an OfflinePlayer. 668 */ 669 public boolean isOfflinePlayer(String path); 670 671 /** 672 * Gets the requested ItemStack by path. 673 * <p> 674 * If the ItemStack does not exist but a default value has been specified, 675 * this will return the default value. If the ItemStack does not exist and 676 * no default value was specified, this will return null. 677 * 678 * @param path Path of the ItemStack to get. 679 * @return Requested ItemStack. 680 */ 681 public ItemStack getItemStack(String path); 682 683 /** 684 * Gets the requested {@link ItemStack} by path, returning a default value 685 * if not found. 686 * <p> 687 * If the ItemStack does not exist then the specified default value will 688 * returned regardless of if a default has been identified in the root 689 * {@link Configuration}. 690 * 691 * @param path Path of the ItemStack to get. 692 * @param def The default value to return if the path is not found or is 693 * not an ItemStack. 694 * @return Requested ItemStack. 695 */ 696 public ItemStack getItemStack(String path, ItemStack def); 697 698 /** 699 * Checks if the specified path is an ItemStack. 700 * <p> 701 * If the path exists but is not a ItemStack, this will return false. If 702 * the path does not exist, this will return false. If the path does not 703 * exist but a default value has been specified, this will check if that 704 * default value is a ItemStack and return appropriately. 705 * 706 * @param path Path of the ItemStack to check. 707 * @return Whether or not the specified path is an ItemStack. 708 */ 709 public boolean isItemStack(String path); 710 711 /** 712 * Gets the requested Color by path. 713 * <p> 714 * If the Color does not exist but a default value has been specified, 715 * this will return the default value. If the Color does not exist and no 716 * default value was specified, this will return null. 717 * 718 * @param path Path of the Color to get. 719 * @return Requested Color. 720 */ 721 public Color getColor(String path); 722 723 /** 724 * Gets the requested {@link Color} by path, returning a default value if 725 * not found. 726 * <p> 727 * If the Color does not exist then the specified default value will 728 * returned regardless of if a default has been identified in the root 729 * {@link Configuration}. 730 * 731 * @param path Path of the Color to get. 732 * @param def The default value to return if the path is not found or is 733 * not a Color. 734 * @return Requested Color. 735 */ 736 public Color getColor(String path, Color def); 737 738 /** 739 * Checks if the specified path is a Color. 740 * <p> 741 * If the path exists but is not a Color, this will return false. If the 742 * path does not exist, this will return false. If the path does not exist 743 * but a default value has been specified, this will check if that default 744 * value is a Color and return appropriately. 745 * 746 * @param path Path of the Color to check. 747 * @return Whether or not the specified path is a Color. 748 */ 749 public boolean isColor(String path); 750 751 /** 752 * Gets the requested ConfigurationSection by path. 753 * <p> 754 * If the ConfigurationSection does not exist but a default value has been 755 * specified, this will return the default value. If the 756 * ConfigurationSection does not exist and no default value was specified, 757 * this will return null. 758 * 759 * @param path Path of the ConfigurationSection to get. 760 * @return Requested ConfigurationSection. 761 */ 762 public ConfigurationSection getConfigurationSection(String path); 763 764 /** 765 * Checks if the specified path is a ConfigurationSection. 766 * <p> 767 * If the path exists but is not a ConfigurationSection, this will return 768 * false. If the path does not exist, this will return false. If the path 769 * does not exist but a default value has been specified, this will check 770 * if that default value is a ConfigurationSection and return 771 * appropriately. 772 * 773 * @param path Path of the ConfigurationSection to check. 774 * @return Whether or not the specified path is a ConfigurationSection. 775 */ 776 public boolean isConfigurationSection(String path); 777 778 /** 779 * Gets the equivalent {@link ConfigurationSection} from the default 780 * {@link Configuration} defined in {@link #getRoot()}. 781 * <p> 782 * If the root contains no defaults, or the defaults doesn't contain a 783 * value for this path, or the value at this path is not a {@link 784 * ConfigurationSection} then this will return null. 785 * 786 * @return Equivalent section in root configuration 787 */ 788 public ConfigurationSection getDefaultSection(); 789 790 /** 791 * Sets the default value in the root at the given path as provided. 792 * <p> 793 * If no source {@link Configuration} was provided as a default 794 * collection, then a new {@link MemoryConfiguration} will be created to 795 * hold the new default value. 796 * <p> 797 * If value is null, the value will be removed from the default 798 * Configuration source. 799 * <p> 800 * If the value as returned by {@link #getDefaultSection()} is null, then 801 * this will create a new section at the path, replacing anything that may 802 * have existed there previously. 803 * 804 * @param path Path of the value to set. 805 * @param value Value to set the default to. 806 * @throws IllegalArgumentException Thrown if path is null. 807 */ 808 public void addDefault(String path, Object value); 809 }