graphql.language.ObjectTypeDefinition Maven / Gradle / Ivy
package graphql.language;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static graphql.language.NodeUtil.directivesByName;
public class ObjectTypeDefinition extends AbstractNode implements TypeDefinition {
private String name;
private final List implementz = new ArrayList<>();
private final List directives = new ArrayList<>();
private final List fieldDefinitions = new ArrayList<>();
public ObjectTypeDefinition(String name) {
this.name = name;
}
public List getImplements() {
return implementz;
}
public List getDirectives() {
return directives;
}
public Map getDirectivesByName() {
return directivesByName(directives);
}
public Directive getDirective(String directiveName) {
return getDirectivesByName().get(directiveName);
}
public List getFieldDefinitions() {
return fieldDefinitions;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public List getChildren() {
List result = new ArrayList<>();
result.addAll(implementz);
result.addAll(directives);
result.addAll(fieldDefinitions);
return result;
}
@Override
public boolean isEqualTo(Node o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ObjectTypeDefinition that = (ObjectTypeDefinition) o;
if ( null == name ) {
if ( null != that.name ) return false;
} else if ( !name.equals(that.name) ) {
return false;
}
return true;
}
@Override
public String toString() {
return "ObjectTypeDefinition{" +
"name='" + name + '\'' +
", implements=" + implementz +
", directives=" + directives +
", fieldDefinitions=" + fieldDefinitions +
'}';
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy