This page contains an explanation of the advanced topics of the Java INI Package, along with code examples and explanations. Although this document aims to be as concise as possible, developers are recommended to consult the javadoc for a more complete and upto date documentation of Java INI Package.

Contents

10. Equality & Compatibility
10.1. Equality
10.2. Compatibility

10. Equality & Compatibility

TODO: write documentation for "10. Equality & Compatibility"

The final topic in this tutorial is Equality & Compatibility. Hopefully, if you've followed the tutorial in order, you should know that you can change whether an IniFile, IniSection or an IniItem is case-sensitive or not, as well as what IniValidator it has. With that in mind, lets begin.

10.1. Equality

To explain what makes to IniFiles equal, we shall look at what makes IniItems equal. Two IniItems are said to be equal if:

  1. they have the same case-sensitivity.
  2. their IniValidators are equal (as defined by IniValidator.equal(Object) method).
  3. they have the same name (if the two IniItmes are case-insensitive then the two names only need to be equal regardless of the name's case).
  4. they have the same pre, end line, and post comments (again, if the twoIniItmes are case-insensitive then the comments only need to be equal regardless of the comments' case).
  5. their values are equal (again, if the twoIniItmes are case-insensitive then the values only need to be equal regardless of the value's case).

IniSections equality has the same first 4 rules as IniItem's, but also are said to be equal if:

Finally, IniFiles equality also has the same first 4 rules as IniItem's, but also are said to be equal if:

10.2. Compatibility

With IniFiles, IniSections and IniItems having different case sensitivity and validators, you will inevitably come across compatibility problems. For example, can you add a case insensitive IniItem called "name" to a case-sensitive. IniSection which already has an IniItem called "Name"?.

To make the whole situation simpler and to avoid any confusions, IniItems and IniSections need to be added to IniSections and IniFiles that they are compatible with. The simple definition on compatibility is that: