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

org.allGraphQLCases.client.pojo.TList 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 java.util.List;

import com.graphql_java_generator.annotation.GraphQLDirective;

/**
 *
 * @author generated by graphql-java-generator
 * @see https://github.com/graphql-java-generator/graphql-java-generator
 */
@GraphQLObjectType("TList")
@SuppressWarnings("unused")
public class TList
	implements IList{
 

	/**
	 * 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 TList(){
		// No action
	}

	@GraphQLNonScalar( fieldName = "list", graphQLTypeSimpleName = "TFoo1", javaClass = org.allGraphQLCases.client.pojo.TFoo1.class, listDepth = 1)
	List list;


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




	@Override
	@SuppressWarnings("unchecked")
	public void setList(List list) {
		if (list == null || list instanceof List) {
			// list is an instance of List. Let's check that this can be copied into a List 
			for (Object item : list) {
				if (! (item instanceof org.allGraphQLCases.client.pojo.TFoo1))
					throw new IllegalArgumentException("The given list should be a list of instances of org.allGraphQLCases.client.pojo.TFoo1, but at least one item is an instance of "
							+ item.getClass().getName());
			}
			this.list = (List) (Object) list;
		} else {
			throw new IllegalArgumentException("The given list should be an instance of List, but is an instance of "
					+ list.getClass().getName());
		}
	}
 

	/** 
	 * 
* As the type declared in the class is not inherited from one of the implemented interfaces, we need a dedicated setter. *
* As the GraphQL type of this field is a list of items that are not of the same type as the field defined in the implemented interface, * we need to have a dedicated setter with a specific name. This is due to Java that does type erasure on parameterized types (for * compatibility reasons with older java versions). As Java can't detect at runtime the type of the items of the list, it can't * decide which setter to call. To overcome this issue, this setter has a dedicated name. * * @param */ public void setListTFoo1(List list) { this.list = list; } /** */ @Override @SuppressWarnings("unchecked") public List getList() { return (List) (Object) list; } public List getListTFoo1() { return list; } @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 "TList {" + "list: " + list + ", " + "__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 List list; public Builder withList(List list) { this.list = list; return this; } public TList build() { TList _object = new TList(); _object.setListTFoo1(list); _object.set__typename("TList"); return _object; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy