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 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 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()); }
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 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()); }
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 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()); }
public FormalParametersListTreeImpl newVariableArgumentFormalParameter(Optional<List<AnnotationTreeImpl>> annotations, InternalSyntaxToken ellipsisToken, VariableTreeImpl variable) { variable.addEllipsisDimension(new ArrayTypeTreeImpl(null, annotations.or(ImmutableList.<AnnotationTreeImpl>of()), ellipsisToken)); return new FormalParametersListTreeImpl( annotations.or(ImmutableList.<AnnotationTreeImpl>of()), ellipsisToken, variable); }
public FormalParametersListTreeImpl newVariableArgumentFormalParameter(Optional<List<AnnotationTreeImpl>> annotations, InternalSyntaxToken ellipsisToken, VariableTreeImpl variable) { variable.addEllipsisDimension(new ArrayTypeTreeImpl(null, annotations.or(ImmutableList.<AnnotationTreeImpl>of()), ellipsisToken)); return new FormalParametersListTreeImpl( annotations.or(ImmutableList.<AnnotationTreeImpl>of()), ellipsisToken, variable); }
public NewArrayTreeImpl completeElementValueArrayInitializer( InternalSyntaxToken openBraceToken, Optional<NewArrayTreeImpl> partial, InternalSyntaxToken closeBraceToken) { NewArrayTreeImpl elementValues = partial.or(new NewArrayTreeImpl(ImmutableList.<ArrayDimensionTree>of(), InitializerListTreeImpl.emptyList())); return elementValues.completeWithCurlyBraces(openBraceToken, closeBraceToken); }
public ArrayAccessExpressionTreeImpl newArrayAccessExpression(Optional<List<AnnotationTreeImpl>> annotations, InternalSyntaxToken openBracketToken, ExpressionTree index, InternalSyntaxToken closeBracketToken) { return new ArrayAccessExpressionTreeImpl(new ArrayDimensionTreeImpl( annotations.or(ImmutableList.<AnnotationTreeImpl>of()), openBracketToken, index, closeBracketToken)); }
public NewArrayTreeImpl completeElementValueArrayInitializer( InternalSyntaxToken openBraceToken, Optional<NewArrayTreeImpl> partial, InternalSyntaxToken closeBraceToken) { NewArrayTreeImpl elementValues = partial.or(new NewArrayTreeImpl(ImmutableList.<ArrayDimensionTree>of(), InitializerListTreeImpl.emptyList())); return elementValues.completeWithCurlyBraces(openBraceToken, closeBraceToken); }
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 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 ExpressionTree newAnnotatedParameterizedIdentifier( Optional<List<AnnotationTreeImpl>> annotations, InternalSyntaxToken identifierToken, Optional<TypeArgumentListTreeImpl> typeArguments) { List<AnnotationTree> annotationList = ImmutableList.copyOf(annotations.or(ImmutableList.of())); ExpressionTree result = new IdentifierTreeImpl(identifierToken); if (typeArguments.isPresent()) { result = new ParameterizedTypeTreeImpl((TypeTree) result, typeArguments.get()); } ((JavaTree.AnnotatedTypeTree) result).complete(annotationList); 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 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); } }
private static ArrayTypeTreeImpl newArrayTypeTreeWithAnnotations(TypeTree type, Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>> dim) { List<AnnotationTreeImpl> annotations = dim.first().or(ImmutableList.<AnnotationTreeImpl>of()); InternalSyntaxToken openBracketToken = dim.second().first(); InternalSyntaxToken closeBracketToken = dim.second().second(); return new ArrayTypeTreeImpl(type, annotations, openBracketToken, closeBracketToken); }
private static ArrayTypeTreeImpl newArrayTypeTreeWithAnnotations(TypeTree type, Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>> dim) { List<AnnotationTreeImpl> annotations = dim.first().or(ImmutableList.<AnnotationTreeImpl>of()); InternalSyntaxToken openBracketToken = dim.second().first(); InternalSyntaxToken closeBracketToken = dim.second().second(); return new ArrayTypeTreeImpl(type, annotations, openBracketToken, closeBracketToken); }
private static ArrayTypeTreeImpl newArrayTypeTreeWithAnnotations(TypeTree type, Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>> dim) { List<AnnotationTreeImpl> annotations = dim.first().or(ImmutableList.<AnnotationTreeImpl>of()); InternalSyntaxToken openBracketToken = dim.second().first(); InternalSyntaxToken closeBracketToken = dim.second().second(); return new ArrayTypeTreeImpl(type, annotations, openBracketToken, closeBracketToken); }