org.dtools.ini
Interface Commentable

All Known Implementing Classes:
AdvancedIniSection, BasicIniSection, IniItem, IniSection

public interface Commentable

This interface states the methods for getting, setting and removing comments to and from an object.

This interface supports three types of comments:

A class that implements this interface is allowed to support or omit any of the comment types, and can omit a type by not implementing the set methods and returning null for the get methods of a particular comment type.

Since:
0.1.10
Version:
0.1.16
Author:
David Lewis

Field Summary
static char COMMENT_SYMBOL
          This single character defines the symbol used as the beginning of a comment in an ini file.
 
Method Summary
 String getEndLineComment()
          Returns the comment that comes after the object on the same line.
 String getPostComment()
          Returns the comment that comes after the object.
 String getPreComment()
          Returns the comment that comes before the object.
 void removeEndLineComment()
          Removes an end line comment from the object.
 void removePostComment()
          Removes a post-comment from the object.
 void removePreComment()
          Removes a pre-comment from the object.
 void setEndLineComment(String comment)
          Set the comment that comes after the object but on the same line.
 void setPostComment(String comment)
          Set the comment that comes after the object.
 void setPreComment(String comment)
          Set the comment that comes before the object.
 

Field Detail

COMMENT_SYMBOL

static final char COMMENT_SYMBOL
This single character defines the symbol used as the beginning of a comment in an ini file. Comments begin with this symbol and continue until the end of the line.

See Also:
Constant Field Values
Method Detail

getPreComment

String getPreComment()

Returns the comment that comes before the object. If not such comment exists an empty string is returned.

Returns:
the comment or "" if no comment exists.
Since:
0.1.10

getEndLineComment

String getEndLineComment()

Returns the comment that comes after the object on the same line. If not such comment exists an empty string is returned.

Returns:
the comment or "" if no comment exists.
Since:
0.1.10

getPostComment

String getPostComment()

Returns the comment that comes after the object. If not such comment exists an empty string is returned.

Returns:
the comment or "" if no comment exists.
Since:
0.1.10

setPreComment

void setPreComment(String comment)

Set the comment that comes before the object.

Parameters:
comment - the text comment, if this value is null, then the comment is set to an empty string.
Since:
0.1.10

setEndLineComment

void setEndLineComment(String comment)

Set the comment that comes after the object but on the same line.

Parameters:
comment - The text comment, if this value is null, then the comment is set to an empty string.
Throws:
IllegalArgumentException - if the given string contains a new line character (i.e. "\n").
Since:
0.1.10

setPostComment

void setPostComment(String comment)
Set the comment that comes after the object.

Parameters:
comment - the text comment, if this value is null, then the comment is set to an empty string.
Since:
0.1.10

removePreComment

void removePreComment()
Removes a pre-comment from the object. This is the equivalent to:
setPreComment("");

Since:
0.1.12

removeEndLineComment

void removeEndLineComment()
Removes an end line comment from the object. This is the equivalent to:
setEndLineComment("");

Since:
0.1.12

removePostComment

void removePostComment()
Removes a post-comment from the object. This is the equivalent to:
setPostComment("");

Since:
0.1.12