public abstract class AbstractElement extends Object implements IniElement
IniElement.| Modifier and Type | Method and Description |
|---|---|
protected void |
changeValue(String newValue)
change value.
|
char |
charAt(int index)
Returns the
char value at the specified index. |
void |
clearComment()
clear comment (if exists).
|
IniComment |
getComment()
there may be comments at the end of each element.
|
String |
getOriginalValue()
get the original string.
|
int |
length()
Returns the length of this character sequence.
|
int |
line()
the line number where you are.
|
protected void |
setOriginalValue(String newOriginalValue) |
String |
setValue(String newValue)
change this element's value.
|
CharSequence |
subSequence(int start,
int end)
Returns a
CharSequence that is a subsequence of this sequence. |
String |
toCompleteString()
Get complete information.
|
String |
toNoCommentString()
like
toString(), without comment value(if exists). |
String |
toString()
Default is
originalValue.toString() |
protected static String |
trim(String value)
trim a value
|
String |
value()
this element's value.
|
protected abstract String |
valueChanged(String newValue)
If the
value changed, change the originalValue |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCommentOptional, isComment, isProperty, isSection, setValuechars, codePointsprotected static String trim(String value)
value - char sequence valueprotected abstract String valueChanged(String newValue)
value changed, change the originalValuenewValue - when value changes, like setValue(String) or IniElement.setValue(java.util.function.Function)public String value()
this element's value.
maybe a toString value like comment,
a property's value like property or a title value like section .
value in interface IniElementprotected void changeValue(String newValue)
newValue - a new valuepublic String setValue(String newValue)
changeValue(String) instead of setValue(String)setValue in interface IniElementnewValue - a new valuevalue()public String toString()
originalValue.toString()toString in interface CharSequencetoString in interface IniElementtoString in class Objectpublic String getOriginalValue()
getOriginalValue in interface IniElementprotected void setOriginalValue(String newOriginalValue)
public IniComment getComment()
IniElementIniElement.getCommentOptional().getComment in interface IniElementIniElement.getCommentOptional()public void clearComment()
clearComment in interface IniElementpublic String toNoCommentString()
toString(), without comment value(if exists).toNoCommentString in interface IniElementpublic String toCompleteString()
section.toString() + all properties.toString() + comment.toString()
In general, it is about the same as toString().toCompleteString in interface IniElementpublic int line()
line in interface IniElementpublic int length()
chars in the sequence.length in interface CharSequencechars in this sequencepublic char charAt(int index)
char value at the specified index. An index ranges from zero
to length() - 1. The first char value of the sequence is at
index zero, the next at index one, and so on, as for array
indexing.
If the char value specified by the index is a
surrogate, the surrogate
value is returned.
charAt in interface CharSequenceindex - the index of the char value to be returnedchar valueIndexOutOfBoundsException - if the index argument is negative or not less than
length()public CharSequence subSequence(int start, int end)
CharSequence that is a subsequence of this sequence.
The subsequence starts with the char value at the specified index and
ends with the char value at index end - 1. The length
(in chars) of the
returned sequence is end - start, so if start == end
then an empty sequence is returned.subSequence in interface CharSequencestart - the start index, inclusiveend - the end index, exclusiveIndexOutOfBoundsException - if start or end are negative,
if end is greater than length(),
or if start is greater than endCopyright © 2021. All rights reserved.