@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(); } }
@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); } }
@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); } }
@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 class VariableDefinitionEntryTemplate { @ForcedType @Mandatory("new lombok.ast.Identifier()") Identifier name1; @NotChildOfNode int arrayDimensions2; Expression initializer3;
@GenerateAstNode class VariableDefinitionEntryTemplate { @ForcedType @Mandatory("new lombok.ast.Identifier()") Identifier name1; @NotChildOfNode int arrayDimensions2; Expression initializer3;
@GenerateAstNode class VariableDefinitionTemplate { @ParentAccessor @Mandatory("new lombok.ast.Modifiers()") @ForcedType Modifiers modifiers1; @Mandatory TypeReference typeReference2; @ParentAccessor List<VariableDefinitionEntry> variables4; @NotChildOfNode boolean varargs3; @CopyMethod static TypeDeclaration upUpIfFieldToTypeDeclaration(VariableDefinition self) { VariableDeclaration decl = self.upToVariableDeclaration(); return decl == null ? null : decl.upUpToTypeDeclaration(); } @CopyMethod static Block upUpIfLocalVariableToBlock(VariableDefinition self) { VariableDeclaration decl = self.upToVariableDeclaration(); return decl == null ? null : decl.upToBlock(); } }
@GenerateAstNode class VariableDefinitionTemplate { @ParentAccessor @Mandatory("new lombok.ast.Modifiers()") @ForcedType Modifiers modifiers1; @Mandatory TypeReference typeReference2; @ParentAccessor List<VariableDefinitionEntry> variables4; @NotChildOfNode boolean varargs3; @CopyMethod static TypeDeclaration upUpIfFieldToTypeDeclaration(VariableDefinition self) { VariableDeclaration decl = self.upToVariableDeclaration(); return decl == null ? null : decl.upUpToTypeDeclaration(); } @CopyMethod static Block upUpIfLocalVariableToBlock(VariableDefinition self) { VariableDeclaration decl = self.upToVariableDeclaration(); return decl == null ? null : decl.upToBlock(); } }
@GenerateAstNode class VariableDefinitionTemplate { @ParentAccessor @Mandatory("new lombok.ast.Modifiers()") @ForcedType Modifiers modifiers1; @Mandatory TypeReference typeReference2; @ParentAccessor List<VariableDefinitionEntry> variables4; @NotChildOfNode boolean varargs3; @CopyMethod static TypeDeclaration upUpIfFieldToTypeDeclaration(VariableDefinition self) { VariableDeclaration decl = self.upToVariableDeclaration(); return decl == null ? null : decl.upUpToTypeDeclaration(); } @CopyMethod static Block upUpIfLocalVariableToBlock(VariableDefinition self) { VariableDeclaration decl = self.upToVariableDeclaration(); return decl == null ? null : decl.upToBlock(); } }