graphql.kickstart.tools.util.Primitives Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graphql-java-tools Show documentation
Show all versions of graphql-java-tools Show documentation
Tools to help map a GraphQL schema to existing Java objects.
package graphql.kickstart.tools.util;
public final class Primitives {
@SuppressWarnings("unchecked")
public static Class wrap(Class type) {
if (boolean.class.equals(type)) {
return (Class) Boolean.class;
} else if (byte.class.equals(type)) {
return (Class) Byte.class;
} else if (char.class.equals(type)) {
return (Class) Character.class;
} else if (double.class.equals(type)) {
return (Class) Double.class;
} else if (float.class.equals(type)) {
return (Class) Float.class;
} else if (int.class.equals(type)) {
return (Class) Integer.class;
} else if (long.class.equals(type)) {
return (Class) Long.class;
} else if (short.class.equals(type)) {
return (Class) Short.class;
} else if (void.class.equals(type)) {
return (Class) Void.class;
} else {
return type;
}
}
}