All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
graphql.language.Field Maven / Gradle / Ivy
package graphql.language;
import graphql.PublicApi;
import graphql.util.TraversalControl;
import graphql.util.TraverserContext;
import java.util.ArrayList;
import java.util.List;
/*
* This is provided to a DataFetcher, therefore it is a public API.
* This might change in the future.
*/
@PublicApi
public class Field extends AbstractNode implements Selection, SelectionSetContainer, DirectivesContainer {
private String name;
private String alias;
private List arguments;
private List directives;
private SelectionSet selectionSet;
public Field() {
this(null, null, new ArrayList<>(), new ArrayList<>(), null);
}
public Field(String name) {
this(name, null, new ArrayList<>(), new ArrayList<>(), null);
}
public Field(String name, SelectionSet selectionSet) {
this(name, null, new ArrayList<>(), new ArrayList<>(), selectionSet);
}
public Field(String name, List arguments) {
this(name, null, arguments, new ArrayList<>(), null);
}
public Field(String name, List arguments, List directives) {
this(name, null, arguments, directives, null);
}
public Field(String name, List arguments, SelectionSet selectionSet) {
this(name, null, arguments, new ArrayList<>(), selectionSet);
}
public Field(String name, String alias, List arguments, List directives, SelectionSet selectionSet) {
this.name = name;
this.alias = alias;
this.arguments = arguments;
this.directives = directives;
this.selectionSet = selectionSet;
}
@Override
public List getChildren() {
List result = new ArrayList<>();
result.addAll(arguments);
result.addAll(directives);
if (selectionSet != null) result.add(selectionSet);
return result;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public List getArguments() {
return arguments;
}
public void setArguments(List arguments) {
this.arguments = arguments;
}
@Override
public List getDirectives() {
return directives;
}
public void setDirectives(List directives) {
this.directives = directives;
}
@Override
public SelectionSet getSelectionSet() {
return selectionSet;
}
public void setSelectionSet(SelectionSet selectionSet) {
this.selectionSet = selectionSet;
}
@Override
public boolean isEqualTo(Node o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Field that = (Field) o;
return NodeUtil.isEqualTo(this.name, that.name) && NodeUtil.isEqualTo(this.alias, that.alias);
}
@Override
public Field deepCopy() {
return new Field(name,
alias,
deepCopy(arguments),
deepCopy(directives),
deepCopy(selectionSet)
);
}
@Override
public String toString() {
return "Field{" +
"name='" + name + '\'' +
", alias='" + alias + '\'' +
", arguments=" + arguments +
", directives=" + directives +
", selectionSet=" + selectionSet +
'}';
}
@Override
public TraversalControl accept(TraverserContext context, NodeVisitor visitor) {
return visitor.visitField(this, context);
}
}