import com.google.common.collect.Range;
import com.google.common.collect.RangeSet;
import com.google.common.util.concurrent.ListenableFuture;
+import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public static final ConcreteType BYTE_ARRAY = typeForClass(byte[].class);
public static final ConcreteType CHAR_ARRAY = typeForClass(char[].class);
+ private static final ConcreteType CLASS = typeForClass(Class.class);
+ private static final ConcreteType OBJECT = typeForClass(Object.class);
private static final ConcreteType PRIMITIVE_VOID = typeForClass(void.class);
+ private static final ConcreteType SERIALIZABLE = typeForClass(Serializable.class);
/**
* It is not desirable to create instance of this class
private Types() {
}
+ /**
+ * Returns an instance of {@link ParameterizedType} which represents JAVA <code>java.lang.Class</code> type
+ * specialized to specified type.
+ *
+ * @param type Type for which to specialize
+ * @return A parameterized type corresponding to {@code Class<Type>}
+ * @throws NullPointerException if {@code type} is null
+ */
+ public static ParameterizedType classType(final Type type) {
+ return parameterizedTypeFor(CLASS, type);
+ }
+
/**
* Returns an instance of {@link ConcreteType} which represents JAVA <code>java.lang.Void</code> type.
*
return VOID;
}
+ /**
+ * Returns an instance of {@link ConcreteType} which represents {@link Object} type.
+ *
+ * @return <code>ConcreteType</code> instance which represents {@link Object}
+ */
+ public static ConcreteType objectType() {
+ return OBJECT;
+ }
+
/**
* Returns an instance of {@link ConcreteType} which represents JAVA <code>void</code> type.
*
return PRIMITIVE_VOID;
}
+ /**
+ * Returns an instance of {@link ConcreteType} which represents {@link Serializable} type.
+ *
+ * @return <code>ConcreteType</code> instance which represents JAVA <code>{@link Serializable}</code>
+ */
+ public static ConcreteType serializableType() {
+ return SERIALIZABLE;
+ }
+
/**
* Returns an instance of {@link ConcreteType} describing the class
*
* JAVA <code>Type</code>s for actual parameter types
* @return <code>ParametrizedType</code> reprezentation of <code>type</code>
* and its parameters <code>parameters</code>
+ * @throws NullPointerException if any argument is null
*/
public static ParameterizedType parameterizedTypeFor(final Type type, final Type... parameters) {
return new ParametrizedTypeImpl(type, parameters);