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.
10. Equality & Compatibility
10.1. Equality
10.2. 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.
To explain what makes to IniFile
s equal, we shall look at what makes
IniItem
s equal. Two IniItem
s are said to be equal if:
IniValidator
s are equal (as defined by IniValidator.equal(Object)
method).IniItme
s are case-insensitive then the two names
only need to be equal regardless of the name's case).IniItme
s are
case-insensitive then the comments only need to be equal regardless of the comments' case).IniItme
s are case-insensitive then the
values only need to be equal regardless of the value's case).IniSection
s equality has the same first 4 rules as IniItem
's, but
also are said to be equal if:
IniItem
sIniItem
in one of the IniSection
s are also present in the other
IniSection
(as defined by the IniItem.equals(Object)
method).IniItem
s is the same in both IniSection
sFinally, IniFile
s equality also has the same first 4 rules as IniItem
's, but
also are said to be equal if:
IniSection
sIniSection
in one of the IniFile
s are also present in the other
IniFile
(as defined by the IniSection.equals(Object)
method).IniSection
s is the same in both IniFile
sWith IniFile
s, IniSection
s and IniItem
s 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, IniItem
s and
IniSection
s need to be added to IniSection
s and IniFile
s that
they are compatible with. The simple definition on compatibility is that:
IniValidator
(as defined by IniValidator.equals(Object)
method