Skip to content

Commit

Permalink
Modernize getDeclarationAsString
Browse files Browse the repository at this point in the history
  • Loading branch information
matozoid committed Mar 22, 2019
1 parent 4927f01 commit 72e8ed1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Expand Up @@ -190,16 +190,6 @@ public T setTypeParameters(final NodeList<TypeParameter> typeParameters) {
return (T) this; return (T) this;
} }


public String getDeclarationAsString(boolean includingModifiers, boolean includingThrows) {
return getDeclarationAsString(includingModifiers, includingThrows, true);
}

public String getDeclarationAsString() {
return getDeclarationAsString(true, true, true);
}

public abstract String getDeclarationAsString(boolean includingModifiers, boolean includingThrows, boolean includingParameterName);

protected String appendThrowsIfRequested(boolean includingThrows) { protected String appendThrowsIfRequested(boolean includingThrows) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (includingThrows) { if (includingThrows) {
Expand Down
Expand Up @@ -35,7 +35,9 @@ public interface NodeWithDeclaration {
* *
* @return String representation of declaration * @return String representation of declaration
*/ */
String getDeclarationAsString(); default String getDeclarationAsString() {
return getDeclarationAsString(true, true, true);
}


/** /**
* As {@link NodeWithDeclaration#getDeclarationAsString(boolean, boolean, boolean)} including * As {@link NodeWithDeclaration#getDeclarationAsString(boolean, boolean, boolean)} including
Expand All @@ -45,7 +47,9 @@ public interface NodeWithDeclaration {
* @param includingThrows flag to include the throws clause (if present) in the string produced * @param includingThrows flag to include the throws clause (if present) in the string produced
* @return String representation of declaration based on parameter flags * @return String representation of declaration based on parameter flags
*/ */
String getDeclarationAsString(boolean includingModifiers, boolean includingThrows); default String getDeclarationAsString(boolean includingModifiers, boolean includingThrows) {
return getDeclarationAsString(includingModifiers, includingThrows, true);
}


/** /**
* A simple representation of the element declaration. * A simple representation of the element declaration.
Expand Down

0 comments on commit 72e8ed1

Please sign in to comment.