All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.allGraphQLCases.client.pojo.TFoo1 Maven / Gradle / Ivy

The newest version!
 /** Generated by the default template from graphql-java-generator */
package org.allGraphQLCases.client.pojo;

import java.util.HashMap;
import java.util.Map;


import com.graphql_java_generator.annotation.GraphQLNonScalar;
import com.graphql_java_generator.annotation.GraphQLObjectType;
import com.graphql_java_generator.annotation.GraphQLScalar;

import com.graphql_java_generator.annotation.GraphQLDirective;

/**
 *  TFoo1 is the basic test case, for issue #114 
 *
 * @author generated by graphql-java-generator
 * @see https://github.com/graphql-java-generator/graphql-java-generator
 */
@GraphQLObjectType("TFoo1")
@SuppressWarnings("unused")
public class TFoo1
	implements IFoo1{
 

	/**
	 * This map contains the deserialized values for the alias, as parsed from the json response from the GraphQL
	 * server. The key is the alias name, the value is the deserialiazed value (taking into account custom scalars,
	 * lists, ...)
	 */
	@com.graphql_java_generator.annotation.GraphQLIgnore
	Map aliasValues = new HashMap<>();

	public TFoo1(){
		// No action
	}

	@GraphQLScalar( fieldName = "id", graphQLTypeSimpleName = "ID", javaClass = java.lang.String.class, listDepth = 0)
	java.lang.String id;


	/**
	 * 
	 * The 'bar' field is a valid GraphQL field. 
	 * But before correction of the issue #114, the generated Java code would not compile, as the TBar is a concrete class that implements IBar
	 * (and not IBar itself as declared in IFoo)
	 */
	@GraphQLNonScalar( fieldName = "bar", graphQLTypeSimpleName = "TBar1", javaClass = org.allGraphQLCases.client.pojo.TBar1.class, listDepth = 0)
	org.allGraphQLCases.client.pojo.TBar1 bar;


	@GraphQLScalar( fieldName = "__typename", graphQLTypeSimpleName = "String", javaClass = java.lang.String.class, listDepth = 0)
	java.lang.String __typename;




	@Override
	public void setId(java.lang.String id) {
		if (id == null || id instanceof java.lang.String) {
			this.id = (java.lang.String) id;
		} else {
			throw new IllegalArgumentException("The given id should be an instance of java.lang.String, but is an instance of "
					+ id.getClass().getName());
		}
	}
 

	@Override
	public java.lang.String getId() {
		return id;
	}


	/**
	  * 
	  * The 'bar' field is a valid GraphQL field. 
	  * But before correction of the issue #114, the generated Java code would not compile, as the TBar is a concrete class that implements IBar
	  * (and not IBar itself as declared in IFoo)
	  */
	@Override
	public void setBar(org.allGraphQLCases.client.pojo.IBar1 bar) {
		if (bar == null || bar instanceof org.allGraphQLCases.client.pojo.TBar1) {
			this.bar = (org.allGraphQLCases.client.pojo.TBar1) bar;
		} else {
			throw new IllegalArgumentException("The given bar should be an instance of org.allGraphQLCases.client.pojo.TBar1, but is an instance of "
					+ bar.getClass().getName());
		}
	}
 

	/** 
	  * 
	  * The 'bar' field is a valid GraphQL field. 
	  * But before correction of the issue #114, the generated Java code would not compile, as the TBar is a concrete class that implements IBar
	  * (and not IBar itself as declared in IFoo)
	 * 
* As the type declared in the class is not inherited from one of the implemented interfaces, we need a dedicated setter. * * @param */ public void setBar(org.allGraphQLCases.client.pojo.TBar1 bar) { this.bar = bar; } /** * * The 'bar' field is a valid GraphQL field. * But before correction of the issue #114, the generated Java code would not compile, as the TBar is a concrete class that implements IBar * (and not IBar itself as declared in IFoo) */ @Override public org.allGraphQLCases.client.pojo.TBar1 getBar() { return bar; } @Override public void set__typename(java.lang.String __typename) { if (__typename == null || __typename instanceof java.lang.String) { this.__typename = (java.lang.String) __typename; } else { throw new IllegalArgumentException("The given __typename should be an instance of java.lang.String, but is an instance of " + __typename.getClass().getName()); } } @Override public java.lang.String get__typename() { return __typename; } /** * This method is called during the json deserialization process, by the {@link GraphQLObjectMapper}, each time an * alias value is read from the json. * * @param aliasName * @param aliasDeserializedValue */ public void setAliasValue(String aliasName, Object aliasDeserializedValue) { aliasValues.put(aliasName, aliasDeserializedValue); } /** * Retrieves the value for the given alias, as it has been received for this object in the GraphQL response.
* This method should not be used for Custom Scalars, as the parser doesn't know if this alias is a custom * scalar, and which custom scalar to use at deserialization time. In most case, a value will then be provided by * this method with a basis json deserialization, but this value won't be the proper custom scalar value. * * @param alias * @return */ public Object getAliasValue(String alias) { return aliasValues.get(alias); } public String toString() { return "TFoo1 {" + "id: " + id + ", " + "bar: " + bar + ", " + "__typename: " + __typename + "}"; } public static Builder builder() { return new Builder(); } /** * The Builder that helps building instance of this POJO. You can get an instance of this class, by calling the * {@link #builder()} */ public static class Builder { private java.lang.String id; private org.allGraphQLCases.client.pojo.TBar1 bar; public Builder withId(java.lang.String id) { this.id = id; return this; } /** * * The 'bar' field is a valid GraphQL field. * But before correction of the issue #114, the generated Java code would not compile, as the TBar is a concrete class that implements IBar * (and not IBar itself as declared in IFoo) */ public Builder withBar(org.allGraphQLCases.client.pojo.TBar1 bar) { this.bar = bar; return this; } public TFoo1 build() { TFoo1 _object = new TFoo1(); _object.setId(id); _object.setBar(bar); _object.set__typename("TFoo1"); return _object; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy