Enum 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 Detail

      • primitiveClass

        public final Class primitiveClass
      • objectClass

        public final Class objectClass
    • 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 name
        NullPointerException - 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