Enum PrimitiveTypeConverter
- java.lang.Object
-
- java.lang.Enum<PrimitiveTypeConverter>
-
- org.bytemechanics.commons.reflection.PrimitiveTypeConverter
-
- All Implemented Interfaces:
Serializable
,Comparable<PrimitiveTypeConverter>
public enum PrimitiveTypeConverter extends Enum<PrimitiveTypeConverter>
This enumerated allows to convert primitive types to it's corresponding class type int - Integer, float - Float... Usage: Class objectClass=PrimitiveTypeConverter.convert(primitiveClass)- Since:
- 1.3.0
- Author:
- afarre
-
-
Field Summary
Fields Modifier and Type Field Description Class
objectClass
Class
primitiveClass
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Class
convert(Class _primitiveClass)
Try to convert primitive types to it's corresponding class type if are primitivesstatic PrimitiveTypeConverter
valueOf(String name)
Returns the enum constant of this type with the specified name.static PrimitiveTypeConverter[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
VOID
public static final PrimitiveTypeConverter VOID
-
BYTE
public static final PrimitiveTypeConverter BYTE
-
BOOLEAN
public static final PrimitiveTypeConverter BOOLEAN
-
INTEGER
public static final PrimitiveTypeConverter INTEGER
-
SHORT
public static final PrimitiveTypeConverter SHORT
-
LONG
public static final PrimitiveTypeConverter LONG
-
FLOAT
public static final PrimitiveTypeConverter FLOAT
-
DOUBLE
public static final PrimitiveTypeConverter DOUBLE
-
CHAR
public static final PrimitiveTypeConverter CHAR
-
-
Method Detail
-
values
public static PrimitiveTypeConverter[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PrimitiveTypeConverter c : PrimitiveTypeConverter.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PrimitiveTypeConverter valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
convert
public static final Class convert(Class _primitiveClass)
Try to convert primitive types to it's corresponding class type if are primitives- Parameters:
_primitiveClass
- primitive to convert- Returns:
- it's corresponding primitive class or the same class if it's not primitive
- Throws:
NullPointerException
- if the class provided is null
-
-