public TypeParameterTreeImpl completeTypeParameter(Optional<List<AnnotationTreeImpl>> annotations, AstNode identifierAstNode, Optional<TypeParameterTreeImpl> partial) { IdentifierTreeImpl identifier = new IdentifierTreeImpl(InternalSyntaxToken.create(identifierAstNode)); if (annotations.isPresent()) { identifier.prependChildren(annotations.get()); } return partial.isPresent() ? partial.get().complete(identifier) : new TypeParameterTreeImpl(identifier); }
public ExpressionTree newIdentifierOrMethodInvocation(Optional<TypeArgumentListTreeImpl> typeArguments, AstNode identifierAstNode, Optional<ArgumentListTreeImpl> arguments) { InternalSyntaxToken identifierToken = InternalSyntaxToken.create(identifierAstNode); IdentifierTreeImpl identifier = new IdentifierTreeImpl(identifierToken); if (typeArguments.isPresent()) { identifier.prependChildren(typeArguments.get()); } ExpressionTree result = identifier; if (arguments.isPresent()) { result = new MethodInvocationTreeImpl(identifier, typeArguments.orNull(), arguments.get(), identifier, arguments.get()); } return result; }
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; }