Class NativeTypes


  • public class NativeTypes
    extends Object
    Provides functionality around the Java primitive data types and their wrapper types. They are considered native.
    Author:
    Gunnar Morling
    • Method Detail

      • getWrapperType

        public static Class<?> getWrapperType​(Class<?> clazz)
      • getPrimitiveType

        public static Class<?> getPrimitiveType​(Class<?> clazz)
      • isNative

        public static boolean isNative​(String fullyQualifiedName)
      • isNumber

        public static boolean isNumber​(Class<?> clazz)
      • getLiteral

        public static Class<?> getLiteral​(String className,
                                          String literal)
        Parameters:
        className - FQN of the literal native class
        literal - literal to verify
        Returns:
        literal class when the literal is a proper literal for the provided kind.
        Throws:
        IllegalArgumentException - when the literal does not match to the provided native type className
      • getName

        public static String getName​(TypeKind typeKind)
        The name that should be used for the typeKind. Should be used in order to get the name of a primitive type
        Parameters:
        typeKind - the type kind
        Returns:
        the name that should be used for the typeKind
      • isNarrowing

        public static boolean isNarrowing​(String sourceFQN,
                                          String targetFQN)