(String path, Object value)
| 164 | } |
| 165 | |
| 166 | public void set(String path, Object value) { |
| 167 | String[] split = path.split(Pattern.quote(Character.toString(getRoot().options().pathSeparator()))); |
| 168 | ConfigurationSection section = this; |
| 169 | |
| 170 | if (path == null) { |
| 171 | throw new IllegalArgumentException("Path cannot be null"); |
| 172 | } else if (path.length() == 0) { |
| 173 | throw new IllegalArgumentException("Cannot set to an empty path"); |
| 174 | } |
| 175 | |
| 176 | for (int i = 0; i < split.length - 1; i++) { |
| 177 | ConfigurationSection last = section; |
| 178 | |
| 179 | section = last.getConfigurationSection(split[i]); |
| 180 | |
| 181 | if (section == null) { |
| 182 | section = last.createSection(split[i]); |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | String key = split[split.length - 1]; |
| 187 | |
| 188 | if (section == this) { |
| 189 | if (value == null) { |
| 190 | map.remove(key); |
| 191 | } else { |
| 192 | map.put(key, prepForStorage(value)); |
| 193 | } |
| 194 | } else { |
| 195 | section.set(key, value); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | public Object get(String path) { |
| 200 | if (path == null) { |
nothing calls this directly
no test coverage detected