public class Primitives extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static Class |
get(String name) |
static boolean |
isBoolean(Type type) |
static boolean |
isByte(Type type) |
static boolean |
isChar(Type type) |
static boolean |
isDouble(Type type) |
static boolean |
isFloat(Type type) |
static boolean |
isInteger(Type type) |
static boolean |
isIntegerCompatible(Class clazz) |
static boolean |
isLong(Type type) |
static boolean |
isPrimitive(Type type)
Returns true if this type is a primitive.
|
static boolean |
isPrimitiveOrPrimitiveWrapperType(Type type) |
static boolean |
isShort(Type type) |
static boolean |
isWrapperType(Type type)
|
static short |
sizeOf(Class<?> type) |
static <T> Class<T> |
unwrap(Class<T> type)
Returns the corresponding primitive type of
type if it is a
wrapper type; otherwise returns type itself. |
static <T> Class<T> |
wrap(Class<T> type)
Returns the corresponding wrapper type of
type if it is a primitive
type; otherwise returns type itself. |
static Class |
wrap(Type type)
wrap a primitive type to warped class
|
public static boolean isPrimitive(Type type)
public static boolean isWrapperType(Type type)
Class.isPrimitive()public static boolean isPrimitiveOrPrimitiveWrapperType(Type type)
public static <T> Class<T> wrap(Class<T> type)
type if it is a primitive
type; otherwise returns type itself. Idempotent.
wrap(int.class) == Integer.class
wrap(Integer.class) == Integer.class
wrap(String.class) == String.class
public static <T> Class<T> unwrap(Class<T> type)
type if it is a
wrapper type; otherwise returns type itself. Idempotent.
unwrap(Integer.class) == int.class
unwrap(int.class) == int.class
unwrap(String.class) == String.class
public static short sizeOf(Class<?> type)
public static boolean isIntegerCompatible(Class clazz)
public static boolean isChar(Type type)
public static boolean isByte(Type type)
public static boolean isShort(Type type)
public static boolean isInteger(Type type)
public static boolean isLong(Type type)
public static boolean isFloat(Type type)
public static boolean isDouble(Type type)
public static boolean isBoolean(Type type)
Copyright © 2021. All rights reserved.