public ExpressionTree newIdentifierOrMethodInvocation(Optional<TypeArgumentListTreeImpl> typeArguments, InternalSyntaxToken identifierToken, Optional<ArgumentListTreeImpl> arguments) { IdentifierTreeImpl identifier = new IdentifierTreeImpl(identifierToken); ExpressionTree result = identifier; if (arguments.isPresent()) { result = new MethodInvocationTreeImpl(identifier, typeArguments.orNull(), arguments.get()); } return result; }
public TryStatementTreeImpl newTryCatch(Optional<List<CatchTreeImpl>> catches, Optional<TryStatementTreeImpl> finallyBlock) { List<CatchTreeImpl> catchTrees = catches.or(ImmutableList.<CatchTreeImpl>of()); if (finallyBlock.isPresent()) { return finallyBlock.get().completeWithCatches(catchTrees); } else { return new TryStatementTreeImpl(catchTrees, null, null); } }
public ModuleDeclarationTree newModuleDeclaration(Optional<List<AnnotationTreeImpl>> annotations, Optional<InternalSyntaxToken> openToken, InternalSyntaxToken moduleToken, ModuleNameTree moduleName, InternalSyntaxToken openBraceToken, Optional<List<ModuleDirectiveTree>> moduleDirectives, InternalSyntaxToken closeBraceToken) { List<AnnotationTree> annotationList = ImmutableList.copyOf(annotations.or(ImmutableList.of())); List<ModuleDirectiveTree> moduleDirectiveList = ImmutableList.copyOf(moduleDirectives.or(ImmutableList.of())); return new ModuleDeclarationTreeImpl(annotationList, openToken.orNull(), moduleToken, moduleName, openBraceToken, moduleDirectiveList, closeBraceToken); }
public FunctionDeclarationTree functionDeclaration( InternalSyntaxToken functionToken, Optional<InternalSyntaxToken> referenceToken, NameIdentifierTree name, ParameterListTree parameters, Optional<ReturnTypeClauseTree> returnTypeClauseTree, BlockTree body ) { return new FunctionDeclarationTreeImpl(functionToken, referenceToken.orNull(), name, parameters, returnTypeClauseTree.orNull(), body); }
public PackageDeclarationTreeImpl newPackageDeclaration(Optional<List<AnnotationTreeImpl>> annotations, InternalSyntaxToken packageToken, ExpressionTree qualifiedIdentifier, InternalSyntaxToken semicolonToken) { List<AnnotationTree> annotationList = ImmutableList.copyOf(annotations.or(ImmutableList.of())); return new PackageDeclarationTreeImpl(annotationList, packageToken, qualifiedIdentifier, semicolonToken); }
public MethodTreeImpl newMethod( TypeTree type, InternalSyntaxToken identifierToken, FormalParametersListTreeImpl parameters, Optional<List<Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>>>> annotatedDimensions, Optional<Tuple<InternalSyntaxToken, QualifiedIdentifierListTreeImpl>> throwsClause, JavaTree blockOrSemicolon) { return newMethodOrConstructor(Optional.of(type), identifierToken, parameters, annotatedDimensions, throwsClause, blockOrSemicolon); }
public MethodTreeImpl newConstructor( InternalSyntaxToken identifierToken, FormalParametersListTreeImpl parameters, Optional<List<Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>>>> annotatedDimensions, Optional<Tuple<InternalSyntaxToken, QualifiedIdentifierListTreeImpl>> throwsClause, JavaTree blockOrSemicolon) { return newMethodOrConstructor(Optional.<TypeTree>absent(), identifierToken, parameters, annotatedDimensions, throwsClause, blockOrSemicolon); }
public FunctionDeclarationTree functionDeclaration( InternalSyntaxToken functionToken, Optional<InternalSyntaxToken> referenceToken, NameIdentifierTree name, ParameterListTree parameters, Optional<ReturnTypeClauseTree> returnTypeClauseTree, BlockTree body ) { return new FunctionDeclarationTreeImpl(functionToken, referenceToken.orNull(), name, parameters, returnTypeClauseTree.orNull(), body); }
public ModuleDeclarationTree newModuleDeclaration(Optional<List<AnnotationTreeImpl>> annotations, Optional<InternalSyntaxToken> openToken, InternalSyntaxToken moduleToken, ModuleNameTree moduleName, InternalSyntaxToken openBraceToken, Optional<List<ModuleDirectiveTree>> moduleDirectives, InternalSyntaxToken closeBraceToken) { List<AnnotationTree> annotationList = ImmutableList.copyOf(annotations.or(ImmutableList.of())); List<ModuleDirectiveTree> moduleDirectiveList = ImmutableList.copyOf(moduleDirectives.or(ImmutableList.of())); return new ModuleDeclarationTreeImpl(annotationList, openToken.orNull(), moduleToken, moduleName, openBraceToken, moduleDirectiveList, closeBraceToken); }
public SwitchStatementTreeImpl switchStatement(InternalSyntaxToken switchToken, InternalSyntaxToken openParenToken, ExpressionTree expression, InternalSyntaxToken closeParenToken, InternalSyntaxToken openBraceToken, Optional<List<CaseGroupTreeImpl>> optionalGroups, InternalSyntaxToken closeBraceToken) { List<CaseGroupTreeImpl> groups = optionalGroups.or(Collections.<CaseGroupTreeImpl>emptyList()); return new SwitchStatementTreeImpl(switchToken, openParenToken, expression, closeParenToken, openBraceToken, groups, closeBraceToken); }
public MethodTreeImpl newMethod( TypeTree type, InternalSyntaxToken identifierToken, FormalParametersListTreeImpl parameters, Optional<List<Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>>>> annotatedDimensions, Optional<Tuple<InternalSyntaxToken, QualifiedIdentifierListTreeImpl>> throwsClause, JavaTree blockOrSemicolon) { return newMethodOrConstructor(Optional.of(type), identifierToken, parameters, annotatedDimensions, throwsClause, blockOrSemicolon); }
public MethodTreeImpl newConstructor( InternalSyntaxToken identifierToken, FormalParametersListTreeImpl parameters, Optional<List<Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>>>> annotatedDimensions, Optional<Tuple<InternalSyntaxToken, QualifiedIdentifierListTreeImpl>> throwsClause, JavaTree blockOrSemicolon) { return newMethodOrConstructor(Optional.<TypeTree>absent(), identifierToken, parameters, annotatedDimensions, throwsClause, blockOrSemicolon); }
@CheckForNull private static ArrayTypeTreeImpl newArrayTypeTreeWithAnnotations(Optional<List<Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>>>> dims) { ArrayTypeTreeImpl result = null; if (dims.isPresent()) { for (Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>> dim : dims.get()) { result = newArrayTypeTreeWithAnnotations(result, dim); } } return result; }
public ExpressionTree newIdentifierOrMethodInvocation(Optional<TypeArgumentListTreeImpl> typeArguments, InternalSyntaxToken identifierToken, Optional<ArgumentListTreeImpl> arguments) { IdentifierTreeImpl identifier = new IdentifierTreeImpl(identifierToken); ExpressionTree result = identifier; if (arguments.isPresent()) { result = new MethodInvocationTreeImpl(identifier, typeArguments.orNull(), arguments.get()); } return result; }
public TryStatementTreeImpl newTryWithResourcesStatement( InternalSyntaxToken tryToken, InternalSyntaxToken openParenToken, ResourceListTreeImpl resources, InternalSyntaxToken closeParenToken, BlockTreeImpl block, Optional<List<CatchTreeImpl>> catches, Optional<TryStatementTreeImpl> finallyBlock) { List<CatchTreeImpl> catchTrees = catches.or(ImmutableList.<CatchTreeImpl>of()); if (finallyBlock.isPresent()) { return finallyBlock.get().completeTryWithResources(tryToken, openParenToken, resources, closeParenToken, block, catchTrees); } else { return new TryStatementTreeImpl(tryToken, openParenToken, resources, closeParenToken, block, catchTrees); } }
public SeparatedListImpl<ArrayPairTree> arrayInitializerList( ArrayPairTree firstElement, Optional<List<Tuple<InternalSyntaxToken, ArrayPairTree>>> restElements, Optional<InternalSyntaxToken> trailingComma ) { return separatedList(firstElement, restElements, trailingComma.orNull()); }
public EnumConstantTreeImpl newEnumConstant( Optional<List<AnnotationTreeImpl>> annotations, InternalSyntaxToken identifierToken, Optional<ArgumentListTreeImpl> arguments, Optional<ClassTreeImpl> classBody, Optional<InternalSyntaxToken> commaToken) { IdentifierTreeImpl identifier = new IdentifierTreeImpl(identifierToken); ArgumentListTreeImpl defaultArguments = new ArgumentListTreeImpl(ImmutableList.<ExpressionTree>of(), ImmutableList.<SyntaxToken>of()); NewClassTreeImpl newClass = new NewClassTreeImpl(arguments.or(defaultArguments), classBody.orNull()); newClass.completeWithIdentifier(identifier); return new EnumConstantTreeImpl(modifiers((Optional<List<ModifierTree>>) (Optional<?>) annotations), identifier, newClass, commaToken.orNull()); }