Class LexicalPreservingPrinter.Observer
- java.lang.Object
-
- com.github.javaparser.ast.observer.PropagatingAstObserver
-
- com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter.Observer
-
- All Implemented Interfaces:
AstObserver
- Enclosing class:
- LexicalPreservingPrinter
private static class LexicalPreservingPrinter.Observer extends PropagatingAstObserver
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.javaparser.ast.observer.AstObserver
AstObserver.ListChangeType
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Observer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
concreteListChange(NodeList changedList, AstObserver.ListChangeType type, int index, Node nodeAddedOrRemoved)
void
concreteListReplacement(NodeList changedList, int index, Node oldValue, Node newValue)
void
concretePropertyChange(Node observedNode, ObservableProperty property, java.lang.Object oldValue, java.lang.Object newValue)
private java.util.List<ChildTextElement>
findChildTextElementForComment(Comment oldValue, NodeText nodeText)
private java.util.List<TokenTextElement>
findTokenTextElementForComment(Comment oldValue, NodeText nodeText)
private void
fixIndentOfMovedNode(NodeText nodeText, int index)
This method inserts new space tokens at the givenindex
.private int
getIndexOfComment(Comment oldValue, NodeText nodeText)
private boolean
isEqualRange(java.util.Optional<Range> range1, java.util.Optional<Range> range2)
-
Methods inherited from class com.github.javaparser.ast.observer.PropagatingAstObserver
listChange, listReplacement, parentChange, propertyChange, transformInPropagatingObserver
-
-
-
-
Method Detail
-
concretePropertyChange
public void concretePropertyChange(Node observedNode, ObservableProperty property, java.lang.Object oldValue, java.lang.Object newValue)
- Overrides:
concretePropertyChange
in classPropagatingAstObserver
-
findChildTextElementForComment
private java.util.List<ChildTextElement> findChildTextElementForComment(Comment oldValue, NodeText nodeText)
-
findTokenTextElementForComment
private java.util.List<TokenTextElement> findTokenTextElementForComment(Comment oldValue, NodeText nodeText)
-
isEqualRange
private boolean isEqualRange(java.util.Optional<Range> range1, java.util.Optional<Range> range2)
-
fixIndentOfMovedNode
private void fixIndentOfMovedNode(NodeText nodeText, int index)
This method inserts new space tokens at the givenindex
. If a new comment is added to the node at the position ofindex
, the new comment and the node will have the same indent.- Parameters:
nodeText
- The text of the nodeindex
- The position where a new comment will be added to
-
concreteListChange
public void concreteListChange(NodeList changedList, AstObserver.ListChangeType type, int index, Node nodeAddedOrRemoved)
- Overrides:
concreteListChange
in classPropagatingAstObserver
-
concreteListReplacement
public void concreteListReplacement(NodeList changedList, int index, Node oldValue, Node newValue)
- Overrides:
concreteListReplacement
in classPropagatingAstObserver
-
-