graphql.language.Field Maven / Gradle / Ivy
The newest version!
package graphql.language;
import java.util.ArrayList;
import java.util.List;
public class Field extends AbstractNode implements Selection {
private String name;
private String alias;
private List arguments = new ArrayList<>();
private List directives = new ArrayList<>();
private SelectionSet selectionSet;
public Field() {
}
public Field(String name) {
this.name = name;
}
public Field(String name, SelectionSet selectionSet) {
this.name = name;
this.selectionSet = selectionSet;
}
public Field(String name, List arguments) {
this.name = name;
this.arguments = arguments;
}
public Field(String name, List arguments, List directives) {
this.name = name;
this.arguments = arguments;
this.directives = directives;
}
public Field(String name, List arguments, SelectionSet selectionSet) {
this.name = name;
this.arguments = arguments;
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;
}
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;
}
public List getDirectives() {
return directives;
}
public void setDirectives(List directives) {
this.directives = directives;
}
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 field = (Field) o;
if (name != null ? !name.equals(field.name) : field.name != null) return false;
return !(alias != null ? !alias.equals(field.alias) : field.alias != null);
}
@Override
public String toString() {
return "Field{" +
"name='" + name + '\'' +
", alias='" + alias + '\'' +
", arguments=" + arguments +
", directives=" + directives +
", selectionSet=" + selectionSet +
'}';
}
}