public enum PrimitiveType extends Enum<PrimitiveType>
| Enum Constant and Description |
|---|
BOOLEAN
Boolean type pair.
|
BYTE
Byte type pair.
|
CHARACTER
Character type pair.
|
DOUBLE
Double type pair.
|
FLOAT
Float type pair.
|
INTEGER
Integer type pair.
|
LONG
Long type pair.
|
SHORT
Short type pair.
|
| Modifier and Type | Method and Description |
|---|---|
static @Nullable PrimitiveType |
from(Class<?> clazz)
Returns the
PrimitiveType entry that corresponds to the given class, or null if not available. |
Object |
getDefaultValue() |
Class<?> |
getPrimitiveType() |
Class<?> |
getReferenceType() |
static boolean |
isRealPrimitive(@Nullable Class<?> clazz)
Returns whether the class is a primitive type.
|
boolean |
matches(@Nullable Class<?> clazz)
Returns whether the given class matches this primitive-reference class pair.
|
static Class<?> |
toPrimitiveType(Class<?> clazz)
Returns the given class's primitive class equivalent, if applicable.
|
static Class<?> |
toReferenceType(Class<?> clazz)
Returns the given class's reference class equivalent, if applicable.
|
static PrimitiveType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static PrimitiveType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final PrimitiveType BOOLEAN
public static final PrimitiveType BYTE
public static final PrimitiveType CHARACTER
public static final PrimitiveType SHORT
public static final PrimitiveType INTEGER
public static final PrimitiveType LONG
public static final PrimitiveType FLOAT
public static final PrimitiveType DOUBLE
public static PrimitiveType[] values()
for (PrimitiveType c : PrimitiveType.values()) System.out.println(c);
public static PrimitiveType valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic Class<?> getPrimitiveType()
public Class<?> getReferenceType()
public Object getDefaultValue()
public boolean matches(@Nullable
@Nullable Class<?> clazz)
clazz - the class to process@Nullable public static @Nullable PrimitiveType from(Class<?> clazz)
PrimitiveType entry that corresponds to the given class, or null if not available.clazz - the class to search for (primitive or reference type of a primitive-reference class pair)public static Class<?> toPrimitiveType(Class<?> clazz)
Note that Void is not converted to void.class.
clazz - the class to processpublic static Class<?> toReferenceType(Class<?> clazz)
Note that void.class is not converted to Void.
clazz - the class to processpublic static boolean isRealPrimitive(@Nullable
@Nullable Class<?> clazz)
Class.isPrimitive(), false is returned
for void.class.clazz - the class to processCopyright © 2023. All rights reserved.