diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-03-04 08:21:35 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-03-04 08:21:35 +0000 |
commit | b4c1397d5df9370f6358d4f8e9efd27e0f67dec1 (patch) | |
tree | 6789ec288d344cf5fd5d057bcf1efc9545b1af28 /javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java | |
parent | 92d661a1d239131fb5c1e019a8f2ac7584d2d3f6 (diff) | |
parent | 1afe9e0652b9b53edade5aa276162abe27b32a67 (diff) | |
download | platform_external_javaparser-pie-r2-s1-release.tar.gz platform_external_javaparser-pie-r2-s1-release.tar.bz2 platform_external_javaparser-pie-r2-s1-release.zip |
Snap for 4632767 from 1afe9e0652b9b53edade5aa276162abe27b32a67 to pi-releaseandroid-wear-9.0.0_r9android-wear-9.0.0_r8android-wear-9.0.0_r7android-wear-9.0.0_r6android-wear-9.0.0_r5android-wear-9.0.0_r4android-wear-9.0.0_r3android-wear-9.0.0_r23android-wear-9.0.0_r22android-wear-9.0.0_r21android-wear-9.0.0_r20android-wear-9.0.0_r2android-wear-9.0.0_r19android-wear-9.0.0_r18android-wear-9.0.0_r17android-wear-9.0.0_r16android-wear-9.0.0_r15android-wear-9.0.0_r14android-wear-9.0.0_r13android-wear-9.0.0_r12android-wear-9.0.0_r11android-wear-9.0.0_r10android-wear-9.0.0_r1android-vts-9.0_r9android-vts-9.0_r8android-vts-9.0_r7android-vts-9.0_r6android-vts-9.0_r5android-vts-9.0_r4android-vts-9.0_r14android-vts-9.0_r13android-vts-9.0_r12android-vts-9.0_r11android-vts-9.0_r10android-cts-9.0_r9android-cts-9.0_r8android-cts-9.0_r7android-cts-9.0_r6android-cts-9.0_r5android-cts-9.0_r4android-cts-9.0_r3android-cts-9.0_r2android-cts-9.0_r13android-cts-9.0_r12android-cts-9.0_r11android-cts-9.0_r10android-cts-9.0_r1android-9.0.0_r9android-9.0.0_r8android-9.0.0_r7android-9.0.0_r60android-9.0.0_r6android-9.0.0_r59android-9.0.0_r58android-9.0.0_r57android-9.0.0_r56android-9.0.0_r55android-9.0.0_r54android-9.0.0_r53android-9.0.0_r52android-9.0.0_r51android-9.0.0_r50android-9.0.0_r5android-9.0.0_r49android-9.0.0_r48android-9.0.0_r3android-9.0.0_r2android-9.0.0_r18android-9.0.0_r17android-9.0.0_r10android-9.0.0_r1security-pi-releasepie-vts-releasepie-security-releasepie-s2-releasepie-release-2pie-releasepie-r2-s2-releasepie-r2-s1-releasepie-r2-releasepie-platform-releasepie-gsipie-cuttlefish-testingpie-cts-release
Change-Id: Ibe65883e94ed5a7272dff3f100393987a1cf3da2
Diffstat (limited to 'javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java')
-rw-r--r-- | javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java new file mode 100644 index 000000000..8accb7b0f --- /dev/null +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2007-2010 JĂșlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2016 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +package com.github.javaparser.ast.expr; + +import com.github.javaparser.ast.AllFieldsConstructor; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.nodeTypes.NodeWithSimpleName; +import com.github.javaparser.ast.observer.ObservableProperty; +import com.github.javaparser.ast.visitor.GenericVisitor; +import com.github.javaparser.ast.visitor.VoidVisitor; +import static com.github.javaparser.utils.Utils.assertNotNull; +import com.github.javaparser.ast.visitor.CloneVisitor; +import com.github.javaparser.metamodel.MemberValuePairMetaModel; +import com.github.javaparser.metamodel.JavaParserMetaModel; +import javax.annotation.Generated; +import com.github.javaparser.TokenRange; + +/** + * A value for a member of an annotation. + * In <code>@Counters(a=15)</code> a=15 is a MemberValuePair. Its name is a, and its value is 15. + * + * @author Julio Vilmar Gesser + */ +public final class MemberValuePair extends Node implements NodeWithSimpleName<MemberValuePair> { + + private SimpleName name; + + private Expression value; + + public MemberValuePair() { + this(null, new SimpleName(), new StringLiteralExpr()); + } + + public MemberValuePair(final String name, final Expression value) { + this(null, new SimpleName(name), value); + } + + @AllFieldsConstructor + public MemberValuePair(final SimpleName name, final Expression value) { + this(null, name, value); + } + + /** + * This constructor is used by the parser and is considered private. + */ + @Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") + public MemberValuePair(TokenRange tokenRange, SimpleName name, Expression value) { + super(tokenRange); + setName(name); + setValue(value); + customInitialization(); + } + + @Override + @Generated("com.github.javaparser.generator.core.node.AcceptGenerator") + public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) { + return v.visit(this, arg); + } + + @Override + @Generated("com.github.javaparser.generator.core.node.AcceptGenerator") + public <A> void accept(final VoidVisitor<A> v, final A arg) { + v.visit(this, arg); + } + + @Generated("com.github.javaparser.generator.core.node.PropertyGenerator") + public SimpleName getName() { + return name; + } + + @Generated("com.github.javaparser.generator.core.node.PropertyGenerator") + public Expression getValue() { + return value; + } + + @Generated("com.github.javaparser.generator.core.node.PropertyGenerator") + public MemberValuePair setName(final SimpleName name) { + assertNotNull(name); + if (name == this.name) { + return (MemberValuePair) this; + } + notifyPropertyChange(ObservableProperty.NAME, this.name, name); + if (this.name != null) + this.name.setParentNode(null); + this.name = name; + setAsParentNodeOf(name); + return this; + } + + @Generated("com.github.javaparser.generator.core.node.PropertyGenerator") + public MemberValuePair setValue(final Expression value) { + assertNotNull(value); + if (value == this.value) { + return (MemberValuePair) this; + } + notifyPropertyChange(ObservableProperty.VALUE, this.value, value); + if (this.value != null) + this.value.setParentNode(null); + this.value = value; + setAsParentNodeOf(value); + return this; + } + + @Override + @Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") + public boolean remove(Node node) { + if (node == null) + return false; + return super.remove(node); + } + + @Override + @Generated("com.github.javaparser.generator.core.node.CloneGenerator") + public MemberValuePair clone() { + return (MemberValuePair) accept(new CloneVisitor(), null); + } + + @Override + @Generated("com.github.javaparser.generator.core.node.GetMetaModelGenerator") + public MemberValuePairMetaModel getMetaModel() { + return JavaParserMetaModel.memberValuePairMetaModel; + } + + @Override + @Generated("com.github.javaparser.generator.core.node.ReplaceMethodGenerator") + public boolean replace(Node node, Node replacementNode) { + if (node == null) + return false; + if (node == name) { + setName((SimpleName) replacementNode); + return true; + } + if (node == value) { + setValue((Expression) replacementNode); + return true; + } + return super.replace(node, replacementNode); + } +} |