Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions src/main/java/graphql/schema/GraphQLEnumType.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public List<GraphQLEnumValueDefinition> getValues() {


public GraphQLEnumType(String name, String description, List<GraphQLEnumValueDefinition> values) {
assertNotNull(name, "name can't be null");
assertNotNull(name, "name can't null");
this.name = name;
this.description = description;
buildMap(values);
Expand All @@ -58,10 +58,6 @@ private void buildMap(List<GraphQLEnumValueDefinition> values) {
}
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}
Expand All @@ -75,6 +71,26 @@ public static Builder newEnum() {
return new Builder();
}

public String getName() {
return name;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

GraphQLType that = (GraphQLType) o;

return getName().equals(that.getName());

}

@Override
public int hashCode() {
return name.hashCode();
}

public static class Builder {

private String name;
Expand Down
30 changes: 22 additions & 8 deletions src/main/java/graphql/schema/GraphQLInputObjectType.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@

import static graphql.Assert.assertNotNull;

public class GraphQLInputObjectType implements GraphQLType, GraphQLInputType, GraphQLUnmodifiedType, GraphQLNullableType {
public class GraphQLInputObjectType implements GraphQLInputType, GraphQLUnmodifiedType, GraphQLNullableType {

private final String name;
private final String description;


private final Map<String, GraphQLInputObjectField> fieldMap = new LinkedHashMap<>();

public GraphQLInputObjectType(String name, String description, List<GraphQLInputObjectField> fields) {
assertNotNull(name, "name can't be null");
assertNotNull(name, "name can't null");
assertNotNull(fields, "fields can't be null");
this.name = name;
this.description = description;
Expand All @@ -30,10 +28,6 @@ private void buildMap(List<GraphQLInputObjectField> fields) {
}
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}
Expand All @@ -50,6 +44,26 @@ public static Builder newInputObject() {
return new Builder();
}

public String getName() {
return name;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

GraphQLType that = (GraphQLType) o;

return getName().equals(that.getName());

}

@Override
public int hashCode() {
return name.hashCode();
}

public static class Builder {
private String name;
private String description;
Expand Down
28 changes: 22 additions & 6 deletions src/main/java/graphql/schema/GraphQLInterfaceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import static graphql.Assert.assertNotNull;

public class GraphQLInterfaceType implements GraphQLType, GraphQLOutputType, GraphQLFieldsContainer, GraphQLCompositeType, GraphQLUnmodifiedType, GraphQLNullableType {
public class GraphQLInterfaceType implements GraphQLOutputType, GraphQLFieldsContainer, GraphQLCompositeType, GraphQLUnmodifiedType, GraphQLNullableType {

private final String name;
private final String description;
Expand Down Expand Up @@ -40,10 +40,6 @@ public List<GraphQLFieldDefinition> getFieldDefinitions() {
return new ArrayList<>(fieldDefinitionsByName.values());
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}
Expand All @@ -55,7 +51,7 @@ public TypeResolver getTypeResolver() {
@Override
public String toString() {
return "GraphQLInterfaceType{" +
"name='" + name + '\'' +
"name='" + getName() + '\'' +
", description='" + description + '\'' +
", fieldDefinitionsByName=" + fieldDefinitionsByName +
", typeResolver=" + typeResolver +
Expand All @@ -66,6 +62,26 @@ public static Builder newInterface() {
return new Builder();
}

public String getName() {
return name;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

GraphQLType that = (GraphQLType) o;

return getName().equals(that.getName());

}

@Override
public int hashCode() {
return name.hashCode();
}


public static class Builder {
private String name;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/graphql/schema/GraphQLList.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import static graphql.Assert.assertNotNull;

public class GraphQLList implements GraphQLType, GraphQLInputType, GraphQLOutputType, GraphQLModifiedType, GraphQLNullableType {
public class GraphQLList implements GraphQLInputType, GraphQLOutputType, GraphQLModifiedType, GraphQLNullableType {

private GraphQLType wrappedType;

Expand Down Expand Up @@ -39,7 +39,6 @@ public int hashCode() {
return wrappedType != null ? wrappedType.hashCode() : 0;
}

@Override
public String getName() {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/graphql/schema/GraphQLNonNull.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import static graphql.Assert.assertNotNull;

public class GraphQLNonNull implements GraphQLType, GraphQLInputType, GraphQLOutputType, GraphQLModifiedType {
public class GraphQLNonNull implements GraphQLInputType, GraphQLOutputType, GraphQLModifiedType {

private GraphQLType wrappedType;

Expand Down
30 changes: 22 additions & 8 deletions src/main/java/graphql/schema/GraphQLObjectType.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import static graphql.Assert.assertNotNull;

public class GraphQLObjectType implements GraphQLType, GraphQLOutputType, GraphQLFieldsContainer, GraphQLCompositeType, GraphQLUnmodifiedType, GraphQLNullableType {
public class GraphQLObjectType implements GraphQLOutputType, GraphQLFieldsContainer, GraphQLCompositeType, GraphQLUnmodifiedType, GraphQLNullableType {

private final String name;
private final String description;
Expand Down Expand Up @@ -50,16 +50,10 @@ public String getDescription() {
return description;
}


public String getName() {
return name;
}


@Override
public String toString() {
return "GraphQLObjectType{" +
"name='" + name + '\'' +
"name='" + getName() + '\'' +
", description='" + description + '\'' +
", fieldDefinitionsByName=" + fieldDefinitionsByName +
", interfaces=" + interfaces +
Expand All @@ -70,6 +64,26 @@ public static Builder newObject() {
return new Builder();
}

public String getName() {
return name;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

GraphQLType that = (GraphQLType) o;

return getName().equals(that.getName());

}

@Override
public int hashCode() {
return name.hashCode();
}


public static class Builder {
private String name;
Expand Down
31 changes: 23 additions & 8 deletions src/main/java/graphql/schema/GraphQLScalarType.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,20 @@

import static graphql.Assert.assertNotNull;

public class GraphQLScalarType implements GraphQLType, GraphQLInputType, GraphQLOutputType, GraphQLUnmodifiedType,GraphQLNullableType {
public class GraphQLScalarType implements GraphQLInputType, GraphQLOutputType, GraphQLUnmodifiedType,GraphQLNullableType {

private final String name;
private final String description;
private final Coercing coercing;


public GraphQLScalarType(String name, String description, Coercing coercing) {
assertNotNull(name, "name can't be null");
assertNotNull(name, "name can't null");
assertNotNull(coercing, "coercing can't be null");
this.name = name;
this.description = description;
this.coercing = coercing;
}

public String getName() {
return name;
}


public String getDescription() {
return description;
Expand All @@ -35,9 +30,29 @@ public Coercing getCoercing() {
@Override
public String toString() {
return "GraphQLScalarType{" +
"name='" + name + '\'' +
"name='" + getName() + '\'' +
", description='" + description + '\'' +
", coercing=" + coercing +
'}';
}

public String getName() {
return name;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

GraphQLType that = (GraphQLType) o;

return getName().equals(that.getName());

}

@Override
public int hashCode() {
return name.hashCode();
}
}
20 changes: 18 additions & 2 deletions src/main/java/graphql/schema/GraphQLTypeReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,32 @@
* A special type to allow a object/interface types to reference itself. It's replaced with the real type
* object when the schema is build.
*/
public class GraphQLTypeReference implements GraphQLType, GraphQLOutputType {
public class GraphQLTypeReference implements GraphQLOutputType {

private final String name;

public GraphQLTypeReference(String name) {
assertNotNull(name, "name can't be null");
assertNotNull(name, "name can't null");
this.name = name;
}

public String getName() {
return name;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

GraphQLType that = (GraphQLType) o;

return getName().equals(that.getName());

}

@Override
public int hashCode() {
return name.hashCode();
}
}
29 changes: 22 additions & 7 deletions src/main/java/graphql/schema/GraphQLUnionType.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import static graphql.Assert.assertNotNull;

public class GraphQLUnionType implements GraphQLType, GraphQLOutputType, GraphQLCompositeType, GraphQLUnmodifiedType, GraphQLNullableType {
public class GraphQLUnionType implements GraphQLOutputType, GraphQLCompositeType, GraphQLUnmodifiedType, GraphQLNullableType {

private final String name;
private final String description;
Expand All @@ -15,7 +15,7 @@ public class GraphQLUnionType implements GraphQLType, GraphQLOutputType, GraphQL


public GraphQLUnionType(String name, String description, List<GraphQLType> types, TypeResolver typeResolver) {
assertNotNull(name, "name can't be null");
assertNotNull(name, "name can't null");
assertNotNull(types, "types can't be null");
assertNotNull(typeResolver, "typeResolver can't be null");
this.name = name;
Expand All @@ -33,11 +33,6 @@ public TypeResolver getTypeResolver() {
return typeResolver;
}

@Override
public String getName() {
return name;
}

public String getDescription() {
return description;
}
Expand All @@ -46,6 +41,26 @@ public static Builder newUnionType() {
return new Builder();
}

public String getName() {
return name;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

GraphQLType that = (GraphQLType) o;

return getName().equals(that.getName());

}

@Override
public int hashCode() {
return name.hashCode();
}

public static class Builder {
private String name;
private String description;
Expand Down