|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dtools.ini.IniSection
org.dtools.ini.BasicIniSection
public class BasicIniSection
A basic\simple implementation of the IniSection
interface.
This class implements only the abstract methods of
AbstractIniSection
and nothing else. Therefore, the performance
of this class is not as good as it could be. However the class stays simple
and provides a quick implementation for the IniFile
interface.
Field Summary |
---|
Fields inherited from class org.dtools.ini.IniSection |
---|
validator |
Fields inherited from interface org.dtools.ini.Commentable |
---|
COMMENT_SYMBOL |
Constructor Summary | |
---|---|
BasicIniSection(String name)
Default constructor which creates a new instance of this IniSection and sets the IniSection to have a
default IniValidator and to be case insensitive. |
|
BasicIniSection(String name,
boolean caseSensitive)
Default constructor which creates a new instance of this IniSection and sets the IniSection to have a
default IniValidator and to be case insensitive. |
|
BasicIniSection(String name,
IniValidator validator)
Default constructor which creates a new instance of this IniSection and sets the IniSection to have a
default IniValidator and to be case insensitive. |
|
BasicIniSection(String name,
IniValidator validator,
boolean caseSensitive)
Default constructor which creates a new instance of this IniSection and sets the IniSection to have a
default IniValidator and to be case insensitive. |
Method Summary | |
---|---|
boolean |
addItem(IniItem item,
int index)
Adds an IniItem to this section at the given index. |
Object |
clone()
This class implements the Cloneable interface, but leaves implementation to subclasses which override this class. |
protected IniItem |
createItem(String name)
This method creates and returns a new instance of an IniItem with the same IniValidator and case
sensitivity as this object. |
IniItem |
getItem(int index)
Get the item which is at the given index. |
Collection<IniItem> |
getItems()
Get a collection of all the items within this section. |
int |
indexOf(IniItem item)
Returns the index of item that is in this section. |
Iterator<IniItem> |
iterator()
|
boolean |
removeItem(IniItem item)
Removes the item this section. |
Methods inherited from class org.dtools.ini.IniSection |
---|
addItem, addItem, addItem, addItems, equals, getEndLineComment, getItem, getItemNames, getName, getNumberOfItems, getPostComment, getPreComment, getValidator, hashCode, hasItem, hasItem, indexOf, isCaseSensitive, isEmpty, merge, moveItem, moveItem, removeAll, removeEndLineComment, removeItem, removeItem, removeItems, removePostComment, removePreComment, setEndLineComment, setPostComment, setPreComment, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BasicIniSection(String name)
Default constructor which creates a new instance of this
IniSection
and sets the IniSection
to have a
default IniValidator
and to be case insensitive.
name
- The name of this IniSection
.
InvalidNameException
- if the name of the IniSection
given is not considered valid by this object's IniValidator
.public BasicIniSection(String name, IniValidator validator)
Default constructor which creates a new instance of this
IniSection
and sets the IniSection
to have a
default IniValidator
and to be case insensitive.
name
- The name of this IniSection
.validator
- The validator of this IniSection
.
InvalidNameException
- if the name of the IniSection
given is not considered valid by this object's IniValidator
.public BasicIniSection(String name, boolean caseSensitive)
Default constructor which creates a new instance of this
IniSection
and sets the IniSection
to have a
default IniValidator
and to be case insensitive.
name
- The name of this IniSection
.caseSensitive
- Sets whether this IniSection
is case
sensitive.
InvalidNameException
- if the name of the IniSection
given is not considered valid by this object's IniValidator
.public BasicIniSection(String name, IniValidator validator, boolean caseSensitive)
Default constructor which creates a new instance of this
IniSection
and sets the IniSection
to have a
default IniValidator
and to be case insensitive.
name
- The name of this IniSection
.validator
- The validator of this IniSection
.caseSensitive
- Sets whether this IniSection
is case
sensitive.
InvalidNameException
- if the name of the IniSection
given is not considered valid by this object's IniValidator
.Method Detail |
---|
public boolean addItem(IniItem item, int index)
IniSection
addItem
in class IniSection
item
- the item to addindex
- the index where to add the item, where 0 is the index of the
first item. Any items that already exists at this index will be
moved to index + 1
. If the value is greater than the
number of items within this section, then the item is appended to
the end of the section.
protected IniItem createItem(String name)
IniSection
IniItem
with the same IniValidator
and case
sensitivity as this object.
createItem
in class IniSection
name
- The name of the IniItem
to create.
IniItem
with the same
IniValidator
and case sensitivity as this object.public IniItem getItem(int index)
IniSection
getItem
in class IniSection
index
- the index of the item to retrieve.
public Collection<IniItem> getItems()
IniSection
getItems
in class IniSection
public int indexOf(IniItem item)
IniSection
-1
is returned.
indexOf
in class IniSection
item
- The IniItem whose index will be returned.
public boolean removeItem(IniItem item)
IniSection
removeItem
in class IniSection
item
- The item to remove.
public Object clone()
IniSection
This class implements the Cloneable interface, but leaves implementation to subclasses which override this class.
clone
in class IniSection
thisObject.equals(
thisObject.clone() );
, but returns false for thisObject ==
thisObject.clone();
public Iterator<IniItem> iterator()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |