- All Superinterfaces:
CharSequence,Serializable
- All Known Subinterfaces:
IniComment,IniProperty,IniSection
- All Known Implementing Classes:
AbstractElement,IniCommentService,IniPropertyService,IniSectionService
IniElement, like
sections, properties, comments. they all can be like String .- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear comment (if exists).there may be comments at the end of each element. or null. if this element is comment, return null. so, nullable, or seegetCommentOptional().default Optional<IniComment> there may be comments at the end of each element. if this element is comment, return itself.get the original string.default booleanAm I comment?default booleanAm I property?default booleanAm I section?intline()the line number where you are.change this element's value.default StringEdit the value of this element on the basis of original value .Get complete information.liketoString(), without comment value(if exists).toString()need to override toString method, to show complete information.value()this element's value. maybe atoStringvalue likecomment, a property's value likepropertyor a title value likesection.Methods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, isEmpty, length, subSequence
-
Method Details
-
value
String value()this element's value. maybe atoStringvalue likecomment, a property's value likepropertyor a title value likesection.- Returns:
- some value
-
setValue
change this element's value.- Parameters:
newValue- a new value- Returns:
- old value
- See Also:
-
getComment
IniComment getComment()there may be comments at the end of each element. or null. if this element is comment, return null. so, nullable, or seegetCommentOptional().- Returns:
- comment end of the element or null. if element, return null.
- See Also:
-
clearComment
void clearComment()clear comment (if exists). -
toNoCommentString
String toNoCommentString()liketoString(), without comment value(if exists).- Returns:
- to string value without comment value.
-
toCompleteString
String toCompleteString()Get complete information. Take sec as an example:section.toString() + all properties.toString() + comment.toString()In general, it is about the same astoString().- Returns:
- the string
-
toString
String toString()need to override toString method, to show complete information.- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject- Returns:
- to string value.
-
getOriginalValue
String getOriginalValue()get the original string.- Returns:
- original string value.
-
line
int line()the line number where you are.- Returns:
- line number.
-
getCommentOptional
there may be comments at the end of each element. if this element is comment, return itself.- Returns:
- comment end of the element. if element, return itself.
- See Also:
-
setValue
Edit the value of this element on the basis of original value .- Parameters:
valueEditor- function to edit old value,oldValue -> { // edit ... return newValue; }- Returns:
- old value
-
isComment
default boolean isComment()Am I comment?- Returns:
- is it a comment?
-
isProperty
default boolean isProperty()Am I property?- Returns:
- is it a property?
-
isSection
default boolean isSection()Am I section?- Returns:
- is it a section?
-