类 ClassHelper


  • public class ClassHelper
    extends Object
    • 字段详细资料

      • ARRAY_SUFFIX

        public static final String ARRAY_SUFFIX
        Suffix for array class names: "[]"
        另请参阅:
        常量字段值
    • 构造器详细资料

      • ClassHelper

        public ClassHelper()
    • 方法详细资料

      • getCallerClassLoader

        public static ClassLoader getCallerClassLoader​(Class<?> caller)
      • getClassLoader

        public static ClassLoader getClassLoader​(Class<?> cls)
        get class loader
        参数:
        cls -
        返回:
        class loader
      • getClassLoader

        public static ClassLoader getClassLoader()
        Return the default ClassLoader to use: typically the thread context ClassLoader, if available; the ClassLoader that loaded the ClassUtils class will be used as fallback.

        Call this method if you intend to use the thread context ClassLoader in a scenario where you absolutely need a non-null ClassLoader reference: for example, for class path resource loading (but not necessarily for Class.forName, which accepts a null ClassLoader reference as well).

        返回:
        the default ClassLoader (never null)
        另请参阅:
        Thread.getContextClassLoader()
      • resolvePrimitiveClassName

        public static Class<?> resolvePrimitiveClassName​(String name)
        Resolve the given class name as primitive class, if appropriate, according to the JVM's naming rules for primitive classes.

        Also supports the JVM's internal class names for primitive arrays. Does not support the "[]" suffix notation for primitive arrays; this is only supported by forName(java.lang.String).

        参数:
        name - the name of the potentially primitive class
        返回:
        the primitive class, or null if the name does not denote a primitive class or primitive array class
      • toShortString

        public static String toShortString​(Object obj)