Solved Configurations - null vs nonexistant

Discussion in 'Plugin Development' started by _LB, Aug 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    _LB

    How can I tell the difference between these two configurations?
    Code:yaml
    1. optionA: true
    2. optionB: null
    3. optionC: 7
    Code:yaml
    1. optionA: true
    2. optionC: 7
    How can I reproduce the first one?
     
  2. Offline

    Totom3

    _LB I guess you can set optionB to null, but that wouldn't change much. If it doesn't find the value at the specified path, it'll return null, unless you specify as a second argument the 'default' value, in case it doesn't find it in the config.

    The only difference I can see between the two is that config.contains("optionB") will probably return true on the first, but false on the second.
     
  3. Offline

    Flamedek

    _LB You could reproduce the first one by setting optionB to the String "null".
    Then when reading it will also return a String..
    I don't think there is any way to store an actual null object as thats just.. null.
     
  4. Offline

    _LB

    OK, so it's just a quirk/limitation in the way the Configurations API works. Thanks!
     
Thread Status:
Not open for further replies.

Share This Page