Class StringNodeVisitor
java.lang.Object
dev.siroshun.configapi.core.node.visitor.StringNodeVisitor
- All Implemented Interfaces:
NodeVisitor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
An interface to appends an object toStringBuilder
.static final class
A builder class ofStringNodeVisitor
. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendQuoteAndEscapedString
(@NotNull String str, @NotNull StringBuilder builder) Appends the quoted/escapedString
toStringBuilder
.static StringNodeVisitor.Builder
builder()
Creates a newStringNodeVisitor.Builder
.static @NotNull StringNodeVisitor
create()
Creates a newStringNodeVisitor
.@NotNull VisitResult
Ends visiting aListNode
.@NotNull VisitResult
Ends visiting aMapNode
.@NotNull VisitResult
Starts visiting aListNode
.@NotNull VisitResult
Starts visiting aMapNode
.@NotNull String
toString()
Gets the result of string representation ofNode
s.@NotNull VisitResult
visit
(@NotNull BooleanArray array) Visits aBooleanArray
.@NotNull VisitResult
visit
(@NotNull BooleanValue value) Visits aBooleanValue
.@NotNull VisitResult
Visits aByteArray
.@NotNull VisitResult
Visits aByteValue
.@NotNull VisitResult
Visits aCharArray
.@NotNull VisitResult
Visits aCharValue
.@NotNull VisitResult
visit
(@NotNull CommentedNode<?> node) Visits aCommentedNode
.@NotNull VisitResult
visit
(@NotNull DoubleArray array) Visits aDoubleArray
.@NotNull VisitResult
visit
(@NotNull DoubleValue value) Visits aDoubleValue
.@NotNull VisitResult
Visits aEnumValue
.@NotNull VisitResult
visit
(@NotNull FloatArray array) Visits aFloatArray
.@NotNull VisitResult
visit
(@NotNull FloatValue value) Visits aFloatValue
.@NotNull VisitResult
Visits aIntArray
.@NotNull VisitResult
Visits aIntValue
.@NotNull VisitResult
Visits aLongArray
.@NotNull VisitResult
Visits aLongValue
.@NotNull VisitResult
Visits aNullNode
.@NotNull VisitResult
visit
(@NotNull ObjectNode<?> node) Visits aObjectNode
.@NotNull VisitResult
visit
(@NotNull ShortArray array) Visits aShortArray
.@NotNull VisitResult
visit
(@NotNull ShortValue value) Visits aShortValue
.@NotNull VisitResult
visit
(@NotNull StringValue value) Visits aStringValue
.@NotNull VisitResult
visitElement
(int index, @NotNull Node<?> node) VisitsListNode
's element.@NotNull VisitResult
visitEntry
(int num, @NotNull Object key, @NotNull Node<?> node) VisitsMapNode
's entry.
-
Method Details
-
appendQuoteAndEscapedString
public static void appendQuoteAndEscapedString(@NotNull @NotNull String str, @NotNull @NotNull StringBuilder builder) Appends the quoted/escapedString
toStringBuilder
.- Parameters:
str
- theString
to appendbuilder
- aStringBuilder
-
create
Creates a newStringNodeVisitor
.- Returns:
- a new
StringNodeVisitor
-
builder
Creates a newStringNodeVisitor.Builder
.- Returns:
- a new
StringNodeVisitor.Builder
-
visit
Description copied from interface:NodeVisitor
Visits aStringValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aStringValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aBooleanArray
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
array
- aBooleanArray
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aBooleanValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aBooleanValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aByteArray
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
array
- aByteArray
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aByteValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aByteValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aCharArray
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
array
- aCharArray
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aCharValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aCharValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aDoubleArray
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
array
- aDoubleArray
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aDoubleValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aDoubleValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aFloatArray
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
array
- aFloatArray
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aFloatValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aFloatValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aIntArray
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
array
- aIntArray
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aIntValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aIntValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aLongArray
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
array
- aLongArray
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aLongValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aLongValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aShortArray
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
array
- aShortArray
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aShortValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aShortValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aEnumValue
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
value
- aEnumValue
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aObjectNode
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
node
- aObjectNode
being visited- Returns:
- a
VisitResult
-
startList
Description copied from interface:NodeVisitor
Starts visiting aListNode
.If this method returns
VisitResult.SKIP
orVisitResult.STOP
,Node.accept(NodeVisitor)
will not visit its elements.- Specified by:
startList
in interfaceNodeVisitor
- Parameters:
node
- aListNode
being visited- Returns:
- a
VisitResult
-
visitElement
Description copied from interface:NodeVisitor
VisitsListNode
's element.If this method returns:
VisitResult.CONTINUE
- CallsNode.accept(NodeVisitor)
of the elementVisitResult.BREAK
- Stops visiting elements and callsNodeVisitor.endList(ListNode)
VisitResult.SKIP
- Skips the element (Node.accept(NodeVisitor)
of the element will not be called)VisitResult.STOP
- Stop visiting immediately andNode.accept(NodeVisitor)
will returnsVisitResult.STOP
- Specified by:
visitElement
in interfaceNodeVisitor
- Parameters:
index
- the index of the element in the listnode
- the element- Returns:
- a
VisitResult
-
endList
Description copied from interface:NodeVisitor
Ends visiting aListNode
.- Specified by:
endList
in interfaceNodeVisitor
- Parameters:
node
- aListNode
being visited- Returns:
- a
VisitResult
-
startMap
Description copied from interface:NodeVisitor
Starts visiting aMapNode
.If this method returns
VisitResult.SKIP
orVisitResult.STOP
,Node.accept(NodeVisitor)
will not visit its entries.- Specified by:
startMap
in interfaceNodeVisitor
- Parameters:
node
- aMapNode
being visited- Returns:
- a
VisitResult
-
visitEntry
@NotNull public @NotNull VisitResult visitEntry(int num, @NotNull @NotNull Object key, @NotNull @NotNull Node<?> node) Description copied from interface:NodeVisitor
VisitsMapNode
's entry.If this method returns:
VisitResult.CONTINUE
- CallsNode.accept(NodeVisitor)
of the entryVisitResult.BREAK
- Stops visiting entries and callsNodeVisitor.endMap(MapNode)
VisitResult.SKIP
- Skips the entry (Node.accept(NodeVisitor)
of the entry will not be called)VisitResult.STOP
- Stop visiting immediately andNode.accept(NodeVisitor)
will returnsVisitResult.STOP
- Specified by:
visitEntry
in interfaceNodeVisitor
- Parameters:
num
- the number of the entry in the mapkey
- the key of the entrynode
- the value of the entry- Returns:
- a
VisitResult
-
endMap
Description copied from interface:NodeVisitor
Ends visiting aMapNode
.- Specified by:
endMap
in interfaceNodeVisitor
- Parameters:
node
- aMapNode
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aCommentedNode
.If this method returns
VisitResult.CONTINUE
,CommentedNode.accept(NodeVisitor)
will callNode.accept(NodeVisitor)
ofCommentedNode.node()
and returns its result.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
node
- aCommentedNode
being visited- Returns:
- a
VisitResult
-
visit
Description copied from interface:NodeVisitor
Visits aNullNode
.- Specified by:
visit
in interfaceNodeVisitor
- Parameters:
node
- aNullNode
being visited- Returns:
- a
VisitResult
-
toString
Gets the result of string representation ofNode
s.
-