//Generated by lombok.ast.template.TemplateProcessor. DO NOT EDIT, DO NOT CHECK IN!

package lombok.ast;

public class AnnotationMethodDeclaration extends lombok.ast.AbstractNode implements lombok.ast.TypeMember, lombok.ast.DescribedNode, lombok.ast.JavadocContainer {
	private lombok.ast.AbstractNode javadoc = null;
	private lombok.ast.AbstractNode modifiers = adopt(new lombok.ast.Modifiers());
	private lombok.ast.AbstractNode returnTypeReference = null;
	private lombok.ast.AbstractNode methodName = adopt(new lombok.ast.Identifier());
	private lombok.ast.AbstractNode defaultValue = null;
	
	public TypeBody upToTypeBody() {
		if (!(this.getParent() instanceof TypeBody)) return null;
		TypeBody out = (TypeBody)this.getParent();
		if (!out.rawMembers().contains(this)) return null;
		return out;
	}
	
	
	public Comment astJavadoc() {
		if (!(this.javadoc instanceof Comment)) return null;
		return (Comment) this.javadoc;
	}
	
	public lombok.ast.AnnotationMethodDeclaration astJavadoc(Comment javadoc) {
		return this.rawJavadoc(javadoc);
	}
	
	public lombok.ast.Node rawJavadoc() {
		return this.javadoc;
	}
	
	public lombok.ast.AnnotationMethodDeclaration rawJavadoc(lombok.ast.Node javadoc) {
		if (javadoc == this.javadoc) return this;
		if (javadoc != null) this.adopt((lombok.ast.AbstractNode)javadoc);
		if (this.javadoc != null) this.disown(this.javadoc);
		this.javadoc = (lombok.ast.AbstractNode)javadoc;
		return this;
	}
	
	public Modifiers astModifiers() {
		if (!(this.modifiers instanceof Modifiers)) return null;
		return (Modifiers) this.modifiers;
	}
	
	public lombok.ast.AnnotationMethodDeclaration astModifiers(Modifiers modifiers) {
		return this.rawModifiers(modifiers);
	}
	
	private lombok.ast.AnnotationMethodDeclaration rawModifiers(lombok.ast.Node modifiers) {
		if (modifiers == this.modifiers) return this;
		if (modifiers != null) this.adopt((lombok.ast.AbstractNode)modifiers);
		if (this.modifiers != null) this.disown(this.modifiers);
		this.modifiers = (lombok.ast.AbstractNode)modifiers;
		return this;
	}
	
	public TypeReference astReturnTypeReference() {
		if (!(this.returnTypeReference instanceof TypeReference)) return null;
		return (TypeReference) this.returnTypeReference;
	}
	
	public lombok.ast.AnnotationMethodDeclaration astReturnTypeReference(TypeReference returnTypeReference) {
		if (returnTypeReference == null) throw new java.lang.NullPointerException("returnTypeReference is mandatory");
		return this.rawReturnTypeReference(returnTypeReference);
	}
	
	public lombok.ast.Node rawReturnTypeReference() {
		return this.returnTypeReference;
	}
	
	public lombok.ast.AnnotationMethodDeclaration rawReturnTypeReference(lombok.ast.Node returnTypeReference) {
		if (returnTypeReference == this.returnTypeReference) return this;
		if (returnTypeReference != null) this.adopt((lombok.ast.AbstractNode)returnTypeReference);
		if (this.returnTypeReference != null) this.disown(this.returnTypeReference);
		this.returnTypeReference = (lombok.ast.AbstractNode)returnTypeReference;
		return this;
	}
	
	public Identifier astMethodName() {
		if (!(this.methodName instanceof Identifier)) return null;
		return (Identifier) this.methodName;
	}
	
	public lombok.ast.AnnotationMethodDeclaration astMethodName(Identifier methodName) {
		return this.rawMethodName(methodName);
	}
	
	private lombok.ast.AnnotationMethodDeclaration rawMethodName(lombok.ast.Node methodName) {
		if (methodName == this.methodName) return this;
		if (methodName != null) this.adopt((lombok.ast.AbstractNode)methodName);
		if (this.methodName != null) this.disown(this.methodName);
		this.methodName = (lombok.ast.AbstractNode)methodName;
		return this;
	}
	
	public Expression astDefaultValue() {
		if (!(this.defaultValue instanceof Expression)) return null;
		return (Expression) this.defaultValue;
	}
	
	public lombok.ast.AnnotationMethodDeclaration astDefaultValue(Expression defaultValue) {
		return this.rawDefaultValue(defaultValue);
	}
	
	public lombok.ast.Node rawDefaultValue() {
		return this.defaultValue;
	}
	
	public lombok.ast.AnnotationMethodDeclaration rawDefaultValue(lombok.ast.Node defaultValue) {
		if (defaultValue == this.defaultValue) return this;
		if (defaultValue != null) this.adopt((lombok.ast.AbstractNode)defaultValue);
		if (this.defaultValue != null) this.disown(this.defaultValue);
		this.defaultValue = (lombok.ast.AbstractNode)defaultValue;
		return this;
	}
	
	@java.lang.Override public java.util.List<Node> getChildren() {
		java.util.List<Node> result = new java.util.ArrayList<Node>();
		if (this.javadoc != null) result.add(this.javadoc);
		if (this.modifiers != null) result.add(this.modifiers);
		if (this.returnTypeReference != null) result.add(this.returnTypeReference);
		if (this.methodName != null) result.add(this.methodName);
		if (this.defaultValue != null) result.add(this.defaultValue);
		return result;
	}
	
	@java.lang.Override public boolean replaceChild(Node original, Node replacement) throws lombok.ast.AstException {
		if (this.javadoc == original) {
			this.rawJavadoc(replacement);
			return true;
		}
		if (this.modifiers == original) {
			if (replacement instanceof Modifiers) {
				this.astModifiers((Modifiers) replacement);
				return true;
			} else throw new lombok.ast.AstException(this, String.format(
					"Cannot replace node: replacement must be of type %s but is of type %s",
					"Modifiers", replacement == null ? "null" : replacement.getClass().getName()));
		}
		if (this.returnTypeReference == original) {
			this.rawReturnTypeReference(replacement);
			return true;
		}
		if (this.methodName == original) {
			if (replacement instanceof Identifier) {
				this.astMethodName((Identifier) replacement);
				return true;
			} else throw new lombok.ast.AstException(this, String.format(
					"Cannot replace node: replacement must be of type %s but is of type %s",
					"Identifier", replacement == null ? "null" : replacement.getClass().getName()));
		}
		if (this.defaultValue == original) {
			this.rawDefaultValue(replacement);
			return true;
		}
		return false;
	}
	
	@java.lang.Override public boolean detach(Node child) {
		if (this.javadoc == child) {
			this.disown((AbstractNode) child);
			this.javadoc = null;
			return true;
		}
		if (this.modifiers == child) {
			this.disown((AbstractNode) child);
			this.modifiers = null;
			return true;
		}
		if (this.returnTypeReference == child) {
			this.disown((AbstractNode) child);
			this.returnTypeReference = null;
			return true;
		}
		if (this.methodName == child) {
			this.disown((AbstractNode) child);
			this.methodName = null;
			return true;
		}
		if (this.defaultValue == child) {
			this.disown((AbstractNode) child);
			this.defaultValue = null;
			return true;
		}
		return false;
	}
	
	@java.lang.Override public void accept(lombok.ast.AstVisitor visitor) {
		if (visitor.visitAnnotationMethodDeclaration(this)) return;
		if (this.javadoc != null) this.javadoc.accept(visitor);
		if (this.modifiers != null) this.modifiers.accept(visitor);
		if (this.returnTypeReference != null) this.returnTypeReference.accept(visitor);
		if (this.methodName != null) this.methodName.accept(visitor);
		if (this.defaultValue != null) this.defaultValue.accept(visitor);
		visitor.afterVisitAnnotationMethodDeclaration(this);
		visitor.endVisit(this);
	}
	
	@java.lang.Override public AnnotationMethodDeclaration copy() {
		AnnotationMethodDeclaration result = new AnnotationMethodDeclaration();
		if (this.javadoc != null) result.rawJavadoc(this.javadoc.copy());
		if (this.modifiers != null) result.rawModifiers(this.modifiers.copy());
		if (this.returnTypeReference != null) result.rawReturnTypeReference(this.returnTypeReference.copy());
		if (this.methodName != null) result.rawMethodName(this.methodName.copy());
		if (this.defaultValue != null) result.rawDefaultValue(this.defaultValue.copy());
		return result;
	}
	
	public java.lang.String getDescription() {
		return lombok.ast.AnnotationMethodDeclarationTemplate.getDescription(this);
	}
	
	public lombok.ast.TypeDeclaration upUpToTypeDeclaration() {
		return lombok.ast.TypeMemberMixin.upUpToTypeDeclaration(this);
	}
	
}
