@Override public Iterable<Tree> children() { ImmutableList.Builder<Tree> iteratorBuilder = ImmutableList.builder(); // the identifierTree simpleName is also present in initializer iteratorBuilder.add(modifiers(), initializer()); SyntaxToken endToken = endToken(); if (endToken != null) { iteratorBuilder.add(endToken); } return iteratorBuilder.build(); }
public EnumConstantTreeImpl(ModifiersTree modifiers, IdentifierTree simpleName, NewClassTreeImpl initializer, @Nullable InternalSyntaxToken separatorToken) { super(Kind.ENUM_CONSTANT, modifiers, simpleName, Preconditions.checkNotNull(initializer)); if (separatorToken != null) { this.setEndToken(separatorToken); } }
public EnumConstantTreeImpl newEnumConstant( Optional<List<AnnotationTreeImpl>> annotations, AstNode identifierAstNode, Optional<ArgumentListTreeImpl> arguments, Optional<ClassTreeImpl> classBody, Optional<AstNode> semicolonTokenAstNode) { IdentifierTreeImpl identifier = new IdentifierTreeImpl(InternalSyntaxToken.create(identifierAstNode)); if (annotations.isPresent()) { identifier.prependChildren(annotations.get()); } List<AstNode> children = Lists.newArrayList(); if (arguments.isPresent()) { children.add(arguments.get()); } if (classBody.isPresent()) { children.add(classBody.get()); } NewClassTreeImpl newClass = new NewClassTreeImpl( arguments.isPresent() ? arguments.get() : Collections.emptyList(), classBody.isPresent() ? classBody.get() : null, children.toArray(new AstNode[0])); newClass.completeWithIdentifier(identifier); @SuppressWarnings("unchecked") EnumConstantTreeImpl result = new EnumConstantTreeImpl(modifiers((Optional<List<ModifierTree>>)(Optional<?>)annotations), identifier, newClass); result.addChild(identifier); result.addChild(newClass); if (semicolonTokenAstNode.isPresent()) { result.addChild(semicolonTokenAstNode.get()); } return result; }
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()); }
@Nullable @Override public SyntaxToken separatorToken() { return endToken(); }
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()); }
@Nullable @Override public SyntaxToken separatorToken() { return endToken(); }
@Override public Iterable<Tree> children() { ImmutableList.Builder<Tree> iteratorBuilder = ImmutableList.builder(); // the identifierTree simpleName is also present in initializer iteratorBuilder.add(modifiers(), initializer()); SyntaxToken endToken = endToken(); if (endToken != null) { iteratorBuilder.add(endToken); } return iteratorBuilder.build(); }
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 EnumConstantTreeImpl(ModifiersTree modifiers, IdentifierTree simpleName, NewClassTreeImpl initializer, @Nullable InternalSyntaxToken separatorToken) { super(Kind.ENUM_CONSTANT, modifiers, simpleName, Preconditions.checkNotNull(initializer)); if (separatorToken != null) { this.setEndToken(separatorToken); } }
@Nullable @Override public SyntaxToken separatorToken() { return endToken(); }
@Override public Iterable<Tree> children() { ImmutableList.Builder<Tree> iteratorBuilder = ImmutableList.builder(); // the identifierTree simpleName is also present in initializer iteratorBuilder.add(modifiers(), initializer()); SyntaxToken endToken = endToken(); if (endToken != null) { iteratorBuilder.add(endToken); } return iteratorBuilder.build(); }
public EnumConstantTreeImpl(ModifiersTree modifiers, IdentifierTree simpleName, NewClassTreeImpl initializer, @Nullable InternalSyntaxToken separatorToken) { super(Kind.ENUM_CONSTANT, modifiers, simpleName, Preconditions.checkNotNull(initializer)); if (separatorToken != null) { this.setEndToken(separatorToken); } }
lastEnumConstant.setEndToken(semicolon); } else { members.add(newEmptyMember(semicolon));
lastEnumConstant.setEndToken(semicolon); } else { members.add(newEmptyMember(semicolon));
lastEnumConstant.setEndToken(semicolon); } else { members.add(newEmptyMember(semicolon));