@GenerateAstNode class ImportDeclarationTemplate { @NotChildOfNode boolean staticImport1; List<Identifier> parts2; @NotChildOfNode boolean starImport3; @CopyMethod static String asFullyQualifiedName(ImportDeclaration self) { StringBuilder result = new StringBuilder(); for (Identifier part : self.astParts()) { if (result.length() != 0) result.append("."); result.append(part.astValue()); } if (self.astStarImport()) result.append(".*"); return result.toString(); } }
@GenerateAstNode class ImportDeclarationTemplate { @NotChildOfNode boolean staticImport1; List<Identifier> parts2; @NotChildOfNode boolean starImport3; @CopyMethod static String asFullyQualifiedName(ImportDeclaration self) { StringBuilder result = new StringBuilder(); for (Identifier part : self.astParts()) { if (result.length() != 0) result.append("."); result.append(part.astValue()); } if (self.astStarImport()) result.append(".*"); return result.toString(); } }
@GenerateAstNode class ImportDeclarationTemplate { @NotChildOfNode boolean staticImport1; List<Identifier> parts2; @NotChildOfNode boolean starImport3; @CopyMethod static String asFullyQualifiedName(ImportDeclaration self) { StringBuilder result = new StringBuilder(); for (Identifier part : self.astParts()) { if (result.length() != 0) result.append("."); result.append(part.astValue()); } if (self.astStarImport()) result.append(".*"); return result.toString(); } }
@GenerateAstNode class CommentTemplate { private static final Pattern DEPRECATED_DETECTOR = Pattern.compile("^(?:.*(?:[*{}]|\\s))?@deprecated(?:(?:[*{}]|\\s).*)?$", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); @NotChildOfNode boolean blockComment1; @NotChildOfNode @Mandatory("\"\"") String content2; @CopyMethod static boolean isJavadoc(Comment self) { return self.astBlockComment() && self.astContent().startsWith("*"); } @CopyMethod static boolean isMarkedDeprecated(Comment self) { return isJavadoc(self) && DEPRECATED_DETECTOR.matcher(self.astContent()).matches(); } }
@GenerateAstNode class CommentTemplate { private static final Pattern DEPRECATED_DETECTOR = Pattern.compile("^(?:.*(?:[*{}]|\\s))?@deprecated(?:(?:[*{}]|\\s).*)?$", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); @NotChildOfNode boolean blockComment1; @NotChildOfNode @Mandatory("\"\"") String content2; @CopyMethod static boolean isJavadoc(Comment self) { return self.astBlockComment() && self.astContent().startsWith("*"); } @CopyMethod static boolean isMarkedDeprecated(Comment self) { return isJavadoc(self) && DEPRECATED_DETECTOR.matcher(self.astContent()).matches(); } }
@GenerateAstNode class CommentTemplate { private static final Pattern DEPRECATED_DETECTOR = Pattern.compile("^(?:.*(?:[*{}]|\\s))?@deprecated(?:(?:[*{}]|\\s).*)?$", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); @NotChildOfNode boolean blockComment1; @NotChildOfNode @Mandatory("\"\"") String content2; @CopyMethod static boolean isJavadoc(Comment self) { return self.astBlockComment() && self.astContent().startsWith("*"); } @CopyMethod static boolean isMarkedDeprecated(Comment self) { return isJavadoc(self) && DEPRECATED_DETECTOR.matcher(self.astContent()).matches(); } }
class ExpressionMixin { @NotChildOfNode(suppressSetter=true, codeToCopy="new java.util.ArrayList<lombok.ast.Position>(this.parensPositions)") @Mandatory("new java.util.ArrayList<lombok.ast.Position>()") List<Position> parensPositions;
class ExpressionMixin { @NotChildOfNode(suppressSetter=true, codeToCopy="new java.util.ArrayList<lombok.ast.Position>(this.parensPositions)") @Mandatory("new java.util.ArrayList<lombok.ast.Position>()") List<Position> parensPositions;
@GenerateAstNode(implementing=DescribedNode.class) class IdentifierTemplate { @NotChildOfNode @Mandatory("\"\"") String value1; @CopyMethod static String getDescription(Identifier self) { return self.astValue(); } @CopyMethod(isStatic=true) static Identifier of(String value) { return new Identifier().astValue(value); } }
@GenerateAstNode(implementing=DescribedNode.class) class IdentifierTemplate { @NotChildOfNode @Mandatory("\"\"") String value1; @CopyMethod static String getDescription(Identifier self) { return self.astValue(); } @CopyMethod(isStatic=true) static Identifier of(String value) { return new Identifier().astValue(value); } }
@GenerateAstNode(implementing=DescribedNode.class) class IdentifierTemplate { @NotChildOfNode @Mandatory("\"\"") String value1; @CopyMethod static String getDescription(Identifier self) { return self.astValue(); } @CopyMethod(isStatic=true) static Identifier of(String value) { return new Identifier().astValue(value); } }
class ExpressionMixin { @NotChildOfNode(suppressSetter=true, codeToCopy="new java.util.ArrayList<lombok.ast.Position>(this.parensPositions)") @Mandatory("new java.util.ArrayList<lombok.ast.Position>()") List<Position> parensPositions;
@GenerateAstNode(implementing={Literal.class, Expression.class}, mixin=ExpressionMixin.class) class BooleanLiteralTemplate { @NotChildOfNode(rawFormParser="parseBoolean", rawFormGenerator="generateBoolean") @Mandatory Boolean value1; static String generateBoolean(Boolean bool) { return String.valueOf(bool); } static Boolean parseBoolean(String bool) { if (bool == null) throw new IllegalArgumentException("missing boolean"); bool = bool.trim(); if (bool.equals("true")) return true; if (bool.equals("false")) return false; throw new IllegalArgumentException("invalid boolean literal:" + bool); } }
@GenerateAstNode(implementing={Literal.class, Expression.class}, mixin=ExpressionMixin.class) class BooleanLiteralTemplate { @NotChildOfNode(rawFormParser="parseBoolean", rawFormGenerator="generateBoolean") @Mandatory Boolean value1; static String generateBoolean(Boolean bool) { return String.valueOf(bool); } static Boolean parseBoolean(String bool) { if (bool == null) throw new IllegalArgumentException("missing boolean"); bool = bool.trim(); if (bool.equals("true")) return true; if (bool.equals("false")) return false; throw new IllegalArgumentException("invalid boolean literal:" + bool); } }
@GenerateAstNode(implementing={Literal.class, Expression.class}, mixin=ExpressionMixin.class) class BooleanLiteralTemplate { @NotChildOfNode(rawFormParser="parseBoolean", rawFormGenerator="generateBoolean") @Mandatory Boolean value1; static String generateBoolean(Boolean bool) { return String.valueOf(bool); } static Boolean parseBoolean(String bool) { if (bool == null) throw new IllegalArgumentException("missing boolean"); bool = bool.trim(); if (bool.equals("true")) return true; if (bool.equals("false")) return false; throw new IllegalArgumentException("invalid boolean literal:" + bool); } }
.build(); @NotChildOfNode @Mandatory("\"\"") String name1;
@GenerateAstNode(implementing={Expression.class, DescribedNode.class}, mixin=ExpressionMixin.class) class UnaryExpressionTemplate { @Mandatory Expression operand2; @NotChildOfNode @Mandatory UnaryOperator operator1; @CopyMethod static String getDescription(UnaryExpression self) { try { return String.format("%s%s%s", self.astOperator().isPostfix() ? "X" : "", self.astOperator().getSymbol(), self.astOperator().isPostfix() ? "" : "X"); } catch (NullPointerException e) { return null; } } @CopyMethod static boolean needsParentheses(Expression self) { try { return BinaryExpressionTemplate.needsParentheses(self, 1); } catch (Throwable ignore) { return true; } } }
@GenerateAstNode(implementing={Expression.class, DescribedNode.class}, mixin=ExpressionMixin.class) class UnaryExpressionTemplate { @Mandatory Expression operand2; @NotChildOfNode @Mandatory UnaryOperator operator1; @CopyMethod static String getDescription(UnaryExpression self) { try { return String.format("%s%s%s", self.astOperator().isPostfix() ? "X" : "", self.astOperator().getSymbol(), self.astOperator().isPostfix() ? "" : "X"); } catch (NullPointerException e) { return null; } } @CopyMethod static boolean needsParentheses(Expression self) { try { return BinaryExpressionTemplate.needsParentheses(self, 1); } catch (Throwable ignore) { return true; } } }
@GenerateAstNode(implementing={Expression.class, DescribedNode.class}, mixin=ExpressionMixin.class) class UnaryExpressionTemplate { @Mandatory Expression operand2; @NotChildOfNode @Mandatory UnaryOperator operator1; @CopyMethod static String getDescription(UnaryExpression self) { try { return String.format("%s%s%s", self.astOperator().isPostfix() ? "X" : "", self.astOperator().getSymbol(), self.astOperator().isPostfix() ? "" : "X"); } catch (NullPointerException e) { return null; } } @CopyMethod static boolean needsParentheses(Expression self) { try { return BinaryExpressionTemplate.needsParentheses(self, 1); } catch (Throwable ignore) { return true; } } }
@GenerateAstNode(implementing=DescribedNode.class) class TypeReferenceTemplate { @NotChildOfNode @Mandatory("lombok.ast.WildcardKind.NONE") WildcardKind wildcard1; @NotChildOfNode int arrayDimensions3;