protected Object getDefault(String path) { if (path == null) { throw new IllegalArgumentException("Path cannot be null"); } Configuration defaults = root.getDefaults(); return (defaults == null) ? null : defaults.get(createPath(this, path)); }
public ConfigurationSection getDefaultSection() { if (getRoot() == null) { return null; } Configuration defaults = getRoot().getDefaults(); if (defaults != null) { if (defaults.isConfigurationSection(getCurrentPath())) { return defaults.getConfigurationSection(getCurrentPath()); } } return null; }
public void addDefault(String path, Object value) { if (path == null) { throw new IllegalArgumentException("Path cannot be null"); } if (root == null) { throw new IllegalStateException("Cannot set default on orphaned section"); } else { root.addDefault(createPath(this, path), value); } }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getClass().getSimpleName()); builder.append("[path='"); builder.append(getCurrentPath()); builder.append("', root='"); builder.append(root.getClass().getSimpleName()); builder.append("']"); return builder.toString(); }