Add @OptionalProperty
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java b/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java
index ecc6cdd..09148fe 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java
@@ -37,6 +37,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
/**
* In <code>new int[1][2];</code> there are two ArrayCreationLevel objects,
@@ -45,6 +46,7 @@
*/
public final class ArrayCreationLevel extends Node implements NodeWithAnnotations<ArrayCreationLevel> {
+ @OptionalProperty
private Expression dimension;
private NodeList<AnnotationExpr> annotations = new NodeList<>();
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java b/javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java
index bae270b..2a6fd92 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java
@@ -40,6 +40,7 @@
import com.github.javaparser.metamodel.CompilationUnitMetaModel;
import com.github.javaparser.metamodel.InternalProperty;
import com.github.javaparser.metamodel.JavaParserMetaModel;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.printer.PrettyPrinter;
import com.github.javaparser.utils.ClassUtils;
import com.github.javaparser.utils.CodeGenerationUtils;
@@ -77,12 +78,14 @@
*/
public final class CompilationUnit extends Node {
+ @OptionalProperty
private PackageDeclaration packageDeclaration;
private NodeList<ImportDeclaration> imports;
private NodeList<TypeDeclaration<?>> types;
+ @OptionalProperty
private ModuleDeclaration module;
@InternalProperty
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/Node.java b/javaparser-core/src/main/java/com/github/javaparser/ast/Node.java
index 423f897..400777d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/Node.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/Node.java
@@ -35,10 +35,7 @@
import com.github.javaparser.ast.visitor.EqualsVisitor;
import com.github.javaparser.ast.visitor.HashCodeVisitor;
import com.github.javaparser.ast.visitor.Visitable;
-import com.github.javaparser.metamodel.InternalProperty;
-import com.github.javaparser.metamodel.JavaParserMetaModel;
-import com.github.javaparser.metamodel.NodeMetaModel;
-import com.github.javaparser.metamodel.PropertyMetaModel;
+import com.github.javaparser.metamodel.*;
import com.github.javaparser.printer.PrettyPrinter;
import com.github.javaparser.printer.PrettyPrinterConfiguration;
import com.github.javaparser.resolution.SymbolResolver;
@@ -55,6 +52,8 @@
import static java.util.Spliterator.DISTINCT;
import static java.util.Spliterator.NONNULL;
import com.github.javaparser.ast.Node;
+import com.github.javaparser.metamodel.NodeMetaModel;
+import com.github.javaparser.metamodel.JavaParserMetaModel;
/**
* Base class for all nodes of the abstract syntax tree.
@@ -164,6 +163,7 @@
@InternalProperty
private IdentityHashMap<DataKey<?>, Object> data = null;
+ @OptionalProperty
private Comment comment;
@InternalProperty
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java
index 1404d57..aa793ef 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java
@@ -135,6 +135,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AnnotationDeclaration> toAnnotationDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java
index e8311b6..48b6db6 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java
@@ -41,6 +41,7 @@
import com.github.javaparser.ast.visitor.VoidVisitor;
import com.github.javaparser.metamodel.AnnotationMemberDeclarationMetaModel;
import com.github.javaparser.metamodel.JavaParserMetaModel;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.resolution.Resolvable;
import com.github.javaparser.resolution.declarations.ResolvedAnnotationMemberDeclaration;
import com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration;
@@ -66,6 +67,7 @@
private SimpleName name;
+ @OptionalProperty
private Expression defaultValue;
public AnnotationMemberDeclaration() {
@@ -266,6 +268,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AnnotationMemberDeclaration> toAnnotationMemberDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java
index 575b000..9658581 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java
@@ -284,46 +284,57 @@
public void ifTypeDeclaration(Consumer<TypeDeclaration> action) {
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AnnotationDeclaration> toAnnotationDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AnnotationMemberDeclaration> toAnnotationMemberDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<CallableDeclaration> toCallableDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ClassOrInterfaceDeclaration> toClassOrInterfaceDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ConstructorDeclaration> toConstructorDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<EnumConstantDeclaration> toEnumConstantDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<EnumDeclaration> toEnumDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<FieldDeclaration> toFieldDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<InitializerDeclaration> toInitializerDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<MethodDeclaration> toMethodDeclaration() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<TypeDeclaration> toTypeDeclaration() {
return Optional.empty();
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/CallableDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/CallableDeclaration.java
index 0eb7848..e2e41fe 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/CallableDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/CallableDeclaration.java
@@ -37,6 +37,7 @@
import com.github.javaparser.ast.visitor.CloneVisitor;
import com.github.javaparser.metamodel.CallableDeclarationMetaModel;
import com.github.javaparser.metamodel.JavaParserMetaModel;
+import com.github.javaparser.metamodel.OptionalProperty;
import javax.annotation.Generated;
import java.util.EnumSet;
import java.util.List;
@@ -61,6 +62,7 @@
private NodeList<ReferenceType> thrownExceptions;
+ @OptionalProperty
private ReceiverParameter receiverParameter;
@AllFieldsConstructor
@@ -419,6 +421,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<CallableDeclaration> toCallableDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java
index 4fadbf2..a275066 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java
@@ -279,6 +279,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ClassOrInterfaceDeclaration> toClassOrInterfaceDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java
index 27367ee..3658d14 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java
@@ -241,6 +241,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ConstructorDeclaration> toConstructorDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java
index 9c7fe6d..5a331e4 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java
@@ -232,6 +232,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<EnumConstantDeclaration> toEnumConstantDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java
index fc7699b..44fb1e4 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java
@@ -226,6 +226,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<EnumDeclaration> toEnumDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java
index 7bef048..547e95a 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java
@@ -300,6 +300,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<FieldDeclaration> toFieldDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java
index 15277e8..06fe78e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java
@@ -167,6 +167,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<InitializerDeclaration> toInitializerDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java
index 4b5cd6d..4a71a50 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java
@@ -46,6 +46,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.resolution.Resolvable;
import com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration;
import java.util.function.Consumer;
@@ -63,6 +64,7 @@
private Type type;
+ @OptionalProperty
private BlockStmt body;
public MethodDeclaration() {
@@ -340,6 +342,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<MethodDeclaration> toMethodDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java
index 3411c75..06f9753 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java
@@ -239,6 +239,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<TypeDeclaration> toTypeDeclaration() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java
index 9c24e0b..45b4959 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java
@@ -37,6 +37,7 @@
import com.github.javaparser.ast.visitor.VoidVisitor;
import com.github.javaparser.metamodel.JavaParserMetaModel;
import com.github.javaparser.metamodel.NonEmptyProperty;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.metamodel.VariableDeclaratorMetaModel;
import java.util.LinkedList;
import java.util.List;
@@ -58,6 +59,7 @@
private SimpleName name;
+ @OptionalProperty
@NonEmptyProperty
private Expression initializer;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java
index a3dfc28..8d30b28 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java
@@ -119,6 +119,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BlockComment> toBlockComment() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java
index 3743bd3..0c5f6b4 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java
@@ -203,14 +203,17 @@
public void ifLineComment(Consumer<LineComment> action) {
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BlockComment> toBlockComment() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<JavadocComment> toJavadocComment() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LineComment> toLineComment() {
return Optional.empty();
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java
index 0c96e6a..d795997 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java
@@ -121,6 +121,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<JavadocComment> toJavadocComment() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java
index dc27035..ddbce80 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java
@@ -118,6 +118,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LineComment> toLineComment() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java
index e64767e..31c70fb 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java
@@ -130,6 +130,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AnnotationExpr> toAnnotationExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java
index 4f439ea..6945dd9 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java
@@ -170,6 +170,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ArrayAccessExpr> toArrayAccessExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java
index 6f3a73a..5099258 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java
@@ -40,6 +40,7 @@
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
import com.github.javaparser.ast.Node;
+import com.github.javaparser.metamodel.OptionalProperty;
import java.util.function.Consumer;
/**
@@ -57,6 +58,7 @@
private Type elementType;
+ @OptionalProperty
private ArrayInitializerExpr initializer;
public ArrayCreationExpr() {
@@ -272,6 +274,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ArrayCreationExpr> toArrayCreationExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java
index 6f6ae26..d585a18 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java
@@ -157,6 +157,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ArrayInitializerExpr> toArrayInitializerExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java
index 2342357..8946e84 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java
@@ -206,6 +206,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AssignExpr> toAssignExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java
index 96fc727..7933156 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java
@@ -207,6 +207,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BinaryExpr> toBinaryExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java
index 3507322..4be43b2 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java
@@ -136,6 +136,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BooleanLiteralExpr> toBooleanLiteralExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java
index 94e921e..174d24c 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java
@@ -173,6 +173,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<CastExpr> toCastExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java
index 3200bca..bc2db00 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java
@@ -156,6 +156,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<CharLiteralExpr> toCharLiteralExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java
index 65f4cc6..729bd4f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java
@@ -147,6 +147,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ClassExpr> toClassExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java
index 333cc96..bdc50a0 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java
@@ -197,6 +197,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ConditionalExpr> toConditionalExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java
index 0447735..007fdf3 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java
@@ -134,6 +134,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<DoubleLiteralExpr> toDoubleLiteralExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java
index 5fbe738..c3d56d8 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java
@@ -155,6 +155,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<EnclosedExpr> toEnclosedExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java
index 3b13483..de9e52b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java
@@ -561,138 +561,172 @@
return getSymbolResolver().calculateType(this);
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AnnotationExpr> toAnnotationExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ArrayAccessExpr> toArrayAccessExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ArrayCreationExpr> toArrayCreationExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ArrayInitializerExpr> toArrayInitializerExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AssignExpr> toAssignExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BinaryExpr> toBinaryExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BooleanLiteralExpr> toBooleanLiteralExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<CastExpr> toCastExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<CharLiteralExpr> toCharLiteralExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ClassExpr> toClassExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ConditionalExpr> toConditionalExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<DoubleLiteralExpr> toDoubleLiteralExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<EnclosedExpr> toEnclosedExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<FieldAccessExpr> toFieldAccessExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<InstanceOfExpr> toInstanceOfExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<IntegerLiteralExpr> toIntegerLiteralExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LambdaExpr> toLambdaExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LiteralExpr> toLiteralExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LiteralStringValueExpr> toLiteralStringValueExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LongLiteralExpr> toLongLiteralExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<MarkerAnnotationExpr> toMarkerAnnotationExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<MethodCallExpr> toMethodCallExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<MethodReferenceExpr> toMethodReferenceExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<NameExpr> toNameExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<NormalAnnotationExpr> toNormalAnnotationExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<NullLiteralExpr> toNullLiteralExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ObjectCreationExpr> toObjectCreationExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SingleMemberAnnotationExpr> toSingleMemberAnnotationExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<StringLiteralExpr> toStringLiteralExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SuperExpr> toSuperExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ThisExpr> toThisExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<TypeExpr> toTypeExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<UnaryExpr> toUnaryExpr() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<VariableDeclarationExpr> toVariableDeclarationExpr() {
return Optional.empty();
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java
index 5668a22..5989a68 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java
@@ -37,6 +37,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import java.util.function.Consumer;
/**
@@ -49,6 +50,7 @@
private Expression scope;
+ @OptionalProperty
private NodeList<Type> typeArguments;
private SimpleName name;
@@ -253,6 +255,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<FieldAccessExpr> toFieldAccessExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java
index 6b672e2..69a505b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java
@@ -174,6 +174,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<InstanceOfExpr> toInstanceOfExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java
index 88ca737..a0d3949 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java
@@ -146,6 +146,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<IntegerLiteralExpr> toIntegerLiteralExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java
index 172c662..a69176f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java
@@ -229,6 +229,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LambdaExpr> toLambdaExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java
index 8bb07da..2c81560 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java
@@ -97,6 +97,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LiteralExpr> toLiteralExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralStringValueExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralStringValueExpr.java
index dbb7afd..4956146 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralStringValueExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralStringValueExpr.java
@@ -116,6 +116,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LiteralStringValueExpr> toLiteralStringValueExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java
index 6be61dd..d15442f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java
@@ -150,6 +150,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LongLiteralExpr> toLongLiteralExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java
index e252652..e9ab894 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java
@@ -121,6 +121,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<MarkerAnnotationExpr> toMarkerAnnotationExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java
index efaf448..dc914c9 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java
@@ -38,6 +38,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.resolution.SymbolResolver;
import com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration;
import java.util.function.Consumer;
@@ -50,8 +51,10 @@
*/
public final class MethodCallExpr extends Expression implements NodeWithTypeArguments<MethodCallExpr>, NodeWithArguments<MethodCallExpr>, NodeWithSimpleName<MethodCallExpr>, NodeWithOptionalScope<MethodCallExpr> {
+ @OptionalProperty
private Expression scope;
+ @OptionalProperty
private NodeList<Type> typeArguments;
private SimpleName name;
@@ -291,6 +294,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<MethodCallExpr> toMethodCallExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java
index 1f45dcf..8ddaac00 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java
@@ -40,6 +40,7 @@
import com.github.javaparser.metamodel.NonEmptyProperty;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import java.util.function.Consumer;
/**
@@ -57,6 +58,7 @@
private Expression scope;
+ @OptionalProperty
private NodeList<Type> typeArguments;
@NonEmptyProperty
@@ -220,6 +222,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<MethodReferenceExpr> toMethodReferenceExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java
index 8adccf8..0eeabd3 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java
@@ -40,6 +40,7 @@
import static com.github.javaparser.utils.Utils.assertNotNull;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
/**
* A name that may consist of multiple identifiers.
@@ -58,6 +59,7 @@
@NonEmptyProperty
private String identifier;
+ @OptionalProperty
private Name qualifier;
private NodeList<AnnotationExpr> annotations;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java
index 22b8d2e..d871589 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java
@@ -158,6 +158,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<NameExpr> toNameExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java
index 18ae0a9..dd0fce5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java
@@ -173,6 +173,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<NormalAnnotationExpr> toNormalAnnotationExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java
index d62a586..b71ed5b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java
@@ -112,6 +112,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<NullLiteralExpr> toNullLiteralExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java
index 3bd95ab..7b702c5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java
@@ -42,6 +42,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration;
import com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration;
import java.util.function.Consumer;
@@ -58,14 +59,17 @@
*/
public final class ObjectCreationExpr extends Expression implements NodeWithTypeArguments<ObjectCreationExpr>, NodeWithType<ObjectCreationExpr, ClassOrInterfaceType>, NodeWithArguments<ObjectCreationExpr>, NodeWithOptionalScope<ObjectCreationExpr> {
+ @OptionalProperty
private Expression scope;
private ClassOrInterfaceType type;
+ @OptionalProperty
private NodeList<Type> typeArguments;
private NodeList<Expression> arguments;
+ @OptionalProperty
private NodeList<BodyDeclaration<?>> anonymousClassBody;
public ObjectCreationExpr() {
@@ -347,6 +351,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ObjectCreationExpr> toObjectCreationExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java
index b9825f3..679c714 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java
@@ -143,6 +143,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SingleMemberAnnotationExpr> toSingleMemberAnnotationExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java
index a71985b..a7b4dd5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java
@@ -166,6 +166,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<StringLiteralExpr> toStringLiteralExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java
index fe38a26..2de37fb 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java
@@ -27,6 +27,7 @@
import java.util.Optional;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.visitor.CloneVisitor;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.metamodel.SuperExprMetaModel;
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
@@ -44,6 +45,7 @@
*/
public final class SuperExpr extends Expression {
+ @OptionalProperty
private Expression classExpr;
public SuperExpr() {
@@ -164,6 +166,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SuperExpr> toSuperExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java
index 9c13377..dc9981d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java
@@ -28,6 +28,7 @@
import java.util.Optional;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.visitor.CloneVisitor;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.metamodel.ThisExprMetaModel;
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
@@ -48,6 +49,7 @@
*/
public final class ThisExpr extends Expression implements Resolvable<ResolvedTypeDeclaration> {
+ @OptionalProperty
private Expression classExpr;
public ThisExpr() {
@@ -167,6 +169,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ThisExpr> toThisExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java
index cd3bd88..3d74b6e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java
@@ -148,6 +148,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<TypeExpr> toTypeExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java
index 8bd9e78..aacae6c 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java
@@ -206,6 +206,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<UnaryExpr> toUnaryExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java
index e455967..8745ce7 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java
@@ -254,6 +254,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<VariableDeclarationExpr> toVariableDeclarationExpr() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleExportsStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleExportsStmt.java
index 8f59ee4..61440b1 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleExportsStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleExportsStmt.java
@@ -157,6 +157,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleExportsStmt> toModuleExportsStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleOpensStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleOpensStmt.java
index 03b9862..25565da 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleOpensStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleOpensStmt.java
@@ -157,6 +157,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleOpensStmt> toModuleOpensStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleProvidesStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleProvidesStmt.java
index 48c3fb8..4ddbced 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleProvidesStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleProvidesStmt.java
@@ -158,6 +158,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleProvidesStmt> toModuleProvidesStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleRequiresStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleRequiresStmt.java
index 2c6dd4b..cede81c 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleRequiresStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleRequiresStmt.java
@@ -154,6 +154,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleRequiresStmt> toModuleRequiresStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleStmt.java
index e75fe7b..176c791 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleStmt.java
@@ -125,22 +125,27 @@
public void ifModuleUsesStmt(Consumer<ModuleUsesStmt> action) {
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleExportsStmt> toModuleExportsStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleOpensStmt> toModuleOpensStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleProvidesStmt> toModuleProvidesStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleRequiresStmt> toModuleRequiresStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleUsesStmt> toModuleUsesStmt() {
return Optional.empty();
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleUsesStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleUsesStmt.java
index a30e880..2bf9856 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleUsesStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/modules/ModuleUsesStmt.java
@@ -120,6 +120,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ModuleUsesStmt> toModuleUsesStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java
index 8e8cb79..a6eb59f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java
@@ -34,6 +34,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import java.util.function.Consumer;
/**
@@ -45,6 +46,7 @@
private Expression check;
+ @OptionalProperty
private Expression message;
public AssertStmt() {
@@ -193,6 +195,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AssertStmt> toAssertStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java
index 4e63fb9..3e25b96 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java
@@ -155,6 +155,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BlockStmt> toBlockStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java
index 1192b43..4a0b411 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java
@@ -32,6 +32,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import java.util.function.Consumer;
/**
@@ -42,6 +43,7 @@
*/
public final class BreakStmt extends Statement {
+ @OptionalProperty
private SimpleName label;
public BreakStmt() {
@@ -166,6 +168,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BreakStmt> toBreakStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java
index 639c7db..b829950 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java
@@ -33,6 +33,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import java.util.function.Consumer;
/**
@@ -44,6 +45,7 @@
*/
public final class ContinueStmt extends Statement implements NodeWithOptionalLabel<ContinueStmt> {
+ @OptionalProperty
private SimpleName label;
public ContinueStmt() {
@@ -168,6 +170,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ContinueStmt> toContinueStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java
index a40ac48..7c161ff 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java
@@ -174,6 +174,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<DoStmt> toDoStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java
index 5fc9897..d73ede6 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java
@@ -110,6 +110,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<EmptyStmt> toEmptyStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java
index 105fb2d..2b9b9c2 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java
@@ -38,6 +38,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration;
import java.util.function.Consumer;
@@ -52,10 +53,12 @@
*/
public final class ExplicitConstructorInvocationStmt extends Statement implements NodeWithTypeArguments<ExplicitConstructorInvocationStmt> {
+ @OptionalProperty
private NodeList<Type> typeArguments;
private boolean isThis;
+ @OptionalProperty
private Expression expression;
private NodeList<Expression> arguments;
@@ -289,6 +292,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ExplicitConstructorInvocationStmt> toExplicitConstructorInvocationStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java
index d8e35fc..483c45d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java
@@ -146,6 +146,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ExpressionStmt> toExpressionStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java
index 9751113..d288991 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java
@@ -33,11 +33,10 @@
import com.github.javaparser.ast.visitor.VoidVisitor;
import com.github.javaparser.metamodel.ForStmtMetaModel;
import com.github.javaparser.metamodel.JavaParserMetaModel;
-
+import com.github.javaparser.metamodel.OptionalProperty;
import javax.annotation.Generated;
import java.util.Optional;
import java.util.function.Consumer;
-
import static com.github.javaparser.utils.Utils.assertNotNull;
/**
@@ -71,6 +70,7 @@
private NodeList<Expression> initialization;
+ @OptionalProperty
private Expression compare;
private NodeList<Expression> update;
@@ -283,6 +283,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ForStmt> toForStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java
index b8158f6..7a04e5b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java
@@ -204,6 +204,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ForeachStmt> toForeachStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java
index bb80cad..f873ff8 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java
@@ -36,6 +36,7 @@
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import java.util.function.Consumer;
/**
@@ -51,6 +52,7 @@
private Statement thenStmt;
+ @OptionalProperty
private Statement elseStmt;
public IfStmt() {
@@ -251,6 +253,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<IfStmt> toIfStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java
index 355dc5b..7906d0c 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java
@@ -174,6 +174,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LabeledStmt> toLabeledStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LocalClassDeclarationStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LocalClassDeclarationStmt.java
index ee1de7b..f78eebc 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LocalClassDeclarationStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LocalClassDeclarationStmt.java
@@ -150,6 +150,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LocalClassDeclarationStmt> toLocalClassDeclarationStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java
index b6538d4..c9bdb45 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java
@@ -29,6 +29,7 @@
import java.util.Optional;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.visitor.CloneVisitor;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.metamodel.ReturnStmtMetaModel;
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
@@ -42,6 +43,7 @@
*/
public final class ReturnStmt extends Statement {
+ @OptionalProperty
private Expression expression;
public ReturnStmt() {
@@ -169,6 +171,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ReturnStmt> toReturnStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java
index 5a6e846..75100e8 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java
@@ -374,86 +374,107 @@
public void ifWhileStmt(Consumer<WhileStmt> action) {
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<AssertStmt> toAssertStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BlockStmt> toBlockStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<BreakStmt> toBreakStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ContinueStmt> toContinueStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<DoStmt> toDoStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<EmptyStmt> toEmptyStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ExplicitConstructorInvocationStmt> toExplicitConstructorInvocationStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ExpressionStmt> toExpressionStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ForStmt> toForStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ForeachStmt> toForeachStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<IfStmt> toIfStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LabeledStmt> toLabeledStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<LocalClassDeclarationStmt> toLocalClassDeclarationStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ReturnStmt> toReturnStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SwitchEntryStmt> toSwitchEntryStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SwitchStmt> toSwitchStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SynchronizedStmt> toSynchronizedStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ThrowStmt> toThrowStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<TryStmt> toTryStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<UnparsableStmt> toUnparsableStmt() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<WhileStmt> toWhileStmt() {
return Optional.empty();
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java
index c32a1b4..afa8fce 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java
@@ -33,6 +33,7 @@
import static com.github.javaparser.utils.Utils.assertNotNull;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.visitor.CloneVisitor;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.metamodel.SwitchEntryStmtMetaModel;
import com.github.javaparser.metamodel.JavaParserMetaModel;
import javax.annotation.Generated;
@@ -61,6 +62,7 @@
*/
public final class SwitchEntryStmt extends Statement implements NodeWithStatements<SwitchEntryStmt> {
+ @OptionalProperty
private Expression label;
private NodeList<Statement> statements;
@@ -215,6 +217,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SwitchEntryStmt> toSwitchEntryStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java
index 778bbb1..81677c5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java
@@ -199,6 +199,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SwitchStmt> toSwitchStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java
index 2b36fc2..376d525 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java
@@ -174,6 +174,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<SynchronizedStmt> toSynchronizedStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java
index a9e8432..736b835 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java
@@ -147,6 +147,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ThrowStmt> toThrowStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java
index 9f0c7db..6e4a81a 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java
@@ -30,6 +30,7 @@
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import com.github.javaparser.metamodel.JavaParserMetaModel;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.metamodel.TryStmtMetaModel;
import javax.annotation.Generated;
import java.util.Arrays;
@@ -101,6 +102,7 @@
private NodeList<CatchClause> catchClauses;
+ @OptionalProperty
private BlockStmt finallyBlock;
public TryStmt() {
@@ -312,6 +314,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<TryStmt> toTryStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/UnparsableStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/UnparsableStmt.java
index 08fcf3b..2a7fc01 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/UnparsableStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/UnparsableStmt.java
@@ -96,6 +96,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<UnparsableStmt> toUnparsableStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java
index 4c7d1a8..5fb1f99 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java
@@ -174,6 +174,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<WhileStmt> toWhileStmt() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java
index d5d8e26..05452bd 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java
@@ -285,6 +285,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ArrayType> toArrayType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java
index 3ea6e14..f3b6846 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java
@@ -41,6 +41,7 @@
import static java.util.stream.Collectors.joining;
import javax.annotation.Generated;
import com.github.javaparser.TokenRange;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.resolution.types.ResolvedReferenceType;
import java.util.function.Consumer;
@@ -58,10 +59,12 @@
*/
public final class ClassOrInterfaceType extends ReferenceType implements NodeWithSimpleName<ClassOrInterfaceType>, NodeWithAnnotations<ClassOrInterfaceType>, NodeWithTypeArguments<ClassOrInterfaceType> {
+ @OptionalProperty
private ClassOrInterfaceType scope;
private SimpleName name;
+ @OptionalProperty
private NodeList<Type> typeArguments;
public ClassOrInterfaceType() {
@@ -292,6 +295,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ClassOrInterfaceType> toClassOrInterfaceType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java
index d672dd7..6b1056b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java
@@ -179,6 +179,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<IntersectionType> toIntersectionType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java
index 5fc257b..f3e209d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java
@@ -233,6 +233,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<PrimitiveType> toPrimitiveType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java
index 9ca8c36..f39ee0e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java
@@ -103,6 +103,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ReferenceType> toReferenceType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java
index f20e926..b28db1d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java
@@ -300,42 +300,52 @@
@Override
public abstract ResolvedType resolve();
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ArrayType> toArrayType() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ClassOrInterfaceType> toClassOrInterfaceType() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<IntersectionType> toIntersectionType() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<PrimitiveType> toPrimitiveType() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<ReferenceType> toReferenceType() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<TypeParameter> toTypeParameter() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<UnionType> toUnionType() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<UnknownType> toUnknownType() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<VoidType> toVoidType() {
return Optional.empty();
}
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<WildcardType> toWildcardType() {
return Optional.empty();
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java
index b2a63a4..c3f8ced 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java
@@ -239,6 +239,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<TypeParameter> toTypeParameter() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java
index 8c77df0..5fa78f1 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java
@@ -188,6 +188,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<UnionType> toUnionType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java
index 260ccbb..d415214 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java
@@ -140,6 +140,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<UnknownType> toUnknownType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java
index 49cc6a9..860a9d6 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java
@@ -135,6 +135,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<VoidType> toVoidType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java
index 6060dcf..870e5ec 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java
@@ -30,6 +30,7 @@
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import com.github.javaparser.metamodel.JavaParserMetaModel;
+import com.github.javaparser.metamodel.OptionalProperty;
import com.github.javaparser.metamodel.WildcardTypeMetaModel;
import java.util.Arrays;
import java.util.List;
@@ -50,8 +51,10 @@
*/
public final class WildcardType extends Type implements NodeWithAnnotations<WildcardType> {
+ @OptionalProperty
private ReferenceType extendedType;
+ @OptionalProperty
private ReferenceType superType;
public WildcardType() {
@@ -291,6 +294,7 @@
}
@Override
+ @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
public Optional<WildcardType> toWildcardType() {
return Optional.of(this);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/metamodel/OptionalProperty.java b/javaparser-core/src/main/java/com/github/javaparser/metamodel/OptionalProperty.java
new file mode 100644
index 0000000..5052e3b
--- /dev/null
+++ b/javaparser-core/src/main/java/com/github/javaparser/metamodel/OptionalProperty.java
@@ -0,0 +1,16 @@
+package com.github.javaparser.metamodel;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Indicate an optional property of a Node.
+ * (Used during generation of the meta model.)
+ */
+@Retention(RUNTIME)
+@Target(FIELD)
+public @interface OptionalProperty {
+}
diff --git a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/AstTypeAnalysis.java b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/AstTypeAnalysis.java
index b199c9f..1801f2d 100644
--- a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/AstTypeAnalysis.java
+++ b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/AstTypeAnalysis.java
@@ -22,7 +22,7 @@
public boolean isSelfType = false;
public Class<?> innerType;
- public AstTypeAnalysis(Type type) {
+ AstTypeAnalysis(Type type) {
if (type instanceof Class<?>) {
TypeVariable<? extends Class<?>>[] typeParameters = ((Class<?>) type).getTypeParameters();
if (typeParameters.length > 0) {
diff --git a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializeConstructorParametersStatementsGenerator.java b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializeConstructorParametersStatementsGenerator.java
index 1ef09da..d50c0ed 100644
--- a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializeConstructorParametersStatementsGenerator.java
+++ b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializeConstructorParametersStatementsGenerator.java
@@ -14,8 +14,8 @@
import static com.github.javaparser.generator.metamodel.MetaModelGenerator.propertyMetaModelFieldName;
import static com.github.javaparser.utils.CodeGenerationUtils.f;
-public class InitializeConstructorParametersStatementsGenerator {
- public void generate(Class<? extends Node> nodeClass, NodeList<Statement> initializeConstructorParametersStatements) {
+class InitializeConstructorParametersStatementsGenerator {
+ void generate(Class<? extends Node> nodeClass, NodeList<Statement> initializeConstructorParametersStatements) {
if (nodeClass == Node.class) {
return;
}
diff --git a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializePropertyMetaModelsStatementsGenerator.java b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializePropertyMetaModelsStatementsGenerator.java
index 1f1c8db..be1ff54 100644
--- a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializePropertyMetaModelsStatementsGenerator.java
+++ b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/InitializePropertyMetaModelsStatementsGenerator.java
@@ -4,6 +4,7 @@
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.stmt.Statement;
import com.github.javaparser.metamodel.NonEmptyProperty;
+import com.github.javaparser.metamodel.OptionalProperty;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -15,12 +16,11 @@
import static com.github.javaparser.utils.CodeGenerationUtils.*;
import static com.github.javaparser.utils.Utils.decapitalize;
-public class InitializePropertyMetaModelsStatementsGenerator {
- public void generate(Class<?> nodeClass, Field field, ClassOrInterfaceDeclaration nodeMetaModelClass, String nodeMetaModelFieldName, NodeList<Statement> initializePropertyMetaModelsStatements) throws NoSuchMethodException {
+class InitializePropertyMetaModelsStatementsGenerator {
+ void generate(Field field, ClassOrInterfaceDeclaration nodeMetaModelClass, String nodeMetaModelFieldName, NodeList<Statement> initializePropertyMetaModelsStatements) throws NoSuchMethodException {
+ final AstTypeAnalysis fieldTypeAnalysis = new AstTypeAnalysis(field.getGenericType());
- final AstTypeAnalysis fieldAnalysis = new AstTypeAnalysis(nodeClass.getMethod(getter(field)).getGenericReturnType());
-
- final Class<?> fieldType = fieldAnalysis.innerType;
+ final Class<?> fieldType = fieldTypeAnalysis.innerType;
final String typeName = fieldType.getTypeName().replace('$', '.');
final String propertyMetaModelFieldName = field.getName() + "PropertyMetaModel";
nodeMetaModelClass.addField("PropertyMetaModel", propertyMetaModelFieldName, PUBLIC);
@@ -29,11 +29,11 @@
field.getName(),
typeName,
optionalOf(decapitalize(nodeMetaModelName(fieldType)), isNode(fieldType)),
- fieldAnalysis.isOptional,
+ isOptional(field),
isNonEmpty(field),
- fieldAnalysis.isNodeList,
- fieldAnalysis.isEnumSet,
- fieldAnalysis.isSelfType);
+ fieldTypeAnalysis.isNodeList,
+ fieldTypeAnalysis.isEnumSet,
+ fieldTypeAnalysis.isSelfType);
final String fieldSetting = f("%s.%s=%s;", nodeMetaModelFieldName, propertyMetaModelFieldName, propertyInitializer);
final String fieldAddition = f("%s.getDeclaredPropertyMetaModels().add(%s.%s);", nodeMetaModelFieldName, nodeMetaModelFieldName, propertyMetaModelFieldName);
@@ -41,23 +41,23 @@
initializePropertyMetaModelsStatements.add(parseStatement(fieldAddition));
}
- public void generateDerivedProperty(Method method, ClassOrInterfaceDeclaration nodeMetaModelClass, String nodeMetaModelFieldName, NodeList<Statement> initializePropertyMetaModelsStatements) {
- final AstTypeAnalysis fieldAnalysis = new AstTypeAnalysis(method.getGenericReturnType());
+ void generateDerivedProperty(Method method, ClassOrInterfaceDeclaration nodeMetaModelClass, String nodeMetaModelFieldName, NodeList<Statement> initializePropertyMetaModelsStatements) {
+ final AstTypeAnalysis returnTypeAnalysis = new AstTypeAnalysis(method.getGenericReturnType());
- final Class<?> fieldType = fieldAnalysis.innerType;
- final String typeName = fieldType.getTypeName().replace('$', '.');
+ final Class<?> innermostReturnType = returnTypeAnalysis.innerType;
+ final String typeName = innermostReturnType.getTypeName().replace('$', '.');
final String propertyMetaModelFieldName = getterToPropertyName(method.getName()) + "PropertyMetaModel";
nodeMetaModelClass.addField("PropertyMetaModel", propertyMetaModelFieldName, PUBLIC);
final String propertyInitializer = f("new PropertyMetaModel(%s, \"%s\", %s.class, %s, %s, %s, %s, %s, %s)",
nodeMetaModelFieldName,
getterToPropertyName(method.getName()),
typeName,
- optionalOf(decapitalize(nodeMetaModelName(fieldType)), isNode(fieldType)),
- fieldAnalysis.isOptional,
+ optionalOf(decapitalize(nodeMetaModelName(innermostReturnType)), isNode(innermostReturnType)),
+ returnTypeAnalysis.isOptional,
isNonEmpty(method),
- fieldAnalysis.isNodeList,
- fieldAnalysis.isEnumSet,
- fieldAnalysis.isSelfType);
+ returnTypeAnalysis.isNodeList,
+ returnTypeAnalysis.isEnumSet,
+ returnTypeAnalysis.isSelfType);
final String fieldSetting = f("%s.%s=%s;", nodeMetaModelFieldName, propertyMetaModelFieldName, propertyInitializer);
final String fieldAddition = f("%s.getDerivedPropertyMetaModels().add(%s.%s);", nodeMetaModelFieldName, nodeMetaModelFieldName, propertyMetaModelFieldName);
@@ -73,8 +73,7 @@
return method.isAnnotationPresent(NonEmptyProperty.class);
}
- private String getter(Field field) {
- return getterName(field.getType(), field.getName());
+ private boolean isOptional(Field field) {
+ return field.isAnnotationPresent(OptionalProperty.class);
}
-
}
diff --git a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/MetaModelGenerator.java b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/MetaModelGenerator.java
index 53a4380..15772b3 100644
--- a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/MetaModelGenerator.java
+++ b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/MetaModelGenerator.java
@@ -164,7 +164,7 @@
}
private void run(SourceRoot sourceRoot) throws IOException, NoSuchMethodException {
- final CompilationUnit javaParserMetaModel = sourceRoot.tryToParse(METAMODEL_PACKAGE, "JavaParserMetaModel.java").getResult().get();
+ final CompilationUnit javaParserMetaModel = sourceRoot.parse(METAMODEL_PACKAGE, "JavaParserMetaModel.java");
generateNodeMetaModels(javaParserMetaModel, sourceRoot);
}
diff --git a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/NodeMetaModelGenerator.java b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/NodeMetaModelGenerator.java
index db17d23..96f92ab 100644
--- a/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/NodeMetaModelGenerator.java
+++ b/javaparser-metamodel-generator/src/main/java/com/github/javaparser/generator/metamodel/NodeMetaModelGenerator.java
@@ -85,7 +85,7 @@
continue;
}
- initializePropertyMetaModelsStatementsGenerator.generate(nodeClass, field, nodeMetaModelClass, nodeMetaModelFieldName, initializePropertyMetaModelsStatements);
+ initializePropertyMetaModelsStatementsGenerator.generate(field, nodeMetaModelClass, nodeMetaModelFieldName, initializePropertyMetaModelsStatements);
}
final List<Method> methods = new ArrayList<>(Arrays.asList(nodeClass.getMethods()));
methods.sort(Comparator.comparing(Method::getName));