java.lang.Object
com.baidu.bjf.remoting.protobuf.utils.compiler.ClassUtils

public class ClassUtils extends Object
ClassUtils. (Tool, Static, ThreadSafe)
从以下版本开始:
1.0.0
作者:
xiemalin
  • 字段详细资料

    • CLASS_EXTENSION

      public static final String CLASS_EXTENSION
      class file extension.
      另请参阅:
    • JAVA_EXTENSION

      public static final String JAVA_EXTENSION
      java source file extension.
      另请参阅:
  • 方法详细资料

    • newInstance

      public static Object newInstance(String name)
      To new instance by class name.
      参数:
      name - class name
      返回:
      new create instance
    • forName

      public static Class<?> forName(String[] packages, String className)
      Use Class.forname to initialize class.
      参数:
      packages - package array
      className - class name
      返回:
      loaded class
    • forName

      public static Class<?> forName(String className)
      Use Class.forname to initialize class.
      参数:
      className - class name
      返回:
      loaded class
    • doFormName

      public static Class<?> doFormName(String className) throws ClassNotFoundException
      Use Class.forname to initialize class.
      参数:
      className - class name
      返回:
      loaded class
      抛出:
      ClassNotFoundException - if class not found
    • getBoxedClass

      public static Class<?> getBoxedClass(Class<?> type)
      Get boxed class for primitive type.
      参数:
      type - primitive class type
      返回:
      Object class type
    • boxed

      public static Boolean boxed(boolean v)
      Boxed primitive boolean type.
      参数:
      v - boolean primitive type
      返回:
      Object type of boolean
    • boxed

      public static Character boxed(char v)
      Boxed primitive char type.
      参数:
      v - boolean char type
      返回:
      Object type of Character
    • boxed

      public static Byte boxed(byte v)
      Boxed primitive byte type.
      参数:
      v - boolean byte type
      返回:
      Object type of Byte
    • boxed

      public static Short boxed(short v)
      Boxed primitive short type.
      参数:
      v - boolean short type
      返回:
      Object type of Short
    • boxed

      public static Integer boxed(int v)
      Boxed.
      参数:
      v - the v
      返回:
      the integer
    • boxed

      public static Long boxed(long v)
      Boxed.
      参数:
      v - the v
      返回:
      the long
    • boxed

      public static Float boxed(float v)
      Boxed.
      参数:
      v - the v
      返回:
      the float
    • boxed

      public static Double boxed(double v)
      Boxed.
      参数:
      v - the v
      返回:
      the double
    • boxed

      public static Object boxed(Object v)
      Boxed.
      参数:
      v - the v
      返回:
      the object
    • unboxed

      public static boolean unboxed(Boolean v)
      Unboxed.
      参数:
      v - the v
      返回:
      true, if successful
    • unboxed

      public static char unboxed(Character v)
      Unboxed.
      参数:
      v - the v
      返回:
      the char
    • unboxed

      public static byte unboxed(Byte v)
      Unboxed.
      参数:
      v - the v
      返回:
      the byte
    • unboxed

      public static short unboxed(Short v)
      Unboxed.
      参数:
      v - the v
      返回:
      the short
    • unboxed

      public static int unboxed(Integer v)
      Unboxed.
      参数:
      v - the v
      返回:
      the int
    • unboxed

      public static long unboxed(Long v)
      Unboxed.
      参数:
      v - the v
      返回:
      the long
    • unboxed

      public static float unboxed(Float v)
      Unboxed.
      参数:
      v - the v
      返回:
      the float
    • unboxed

      public static double unboxed(Double v)
      Unboxed.
      参数:
      v - the v
      返回:
      the double
    • unboxed

      public static Object unboxed(Object v)
      Unboxed.
      参数:
      v - the v
      返回:
      the object
    • isNotEmpty

      public static boolean isNotEmpty(Object object)
      Checks if is not empty.
      参数:
      object - the object
      返回:
      true, if is not empty
    • getSize

      public static int getSize(Object object)
      Gets the size.
      参数:
      object - the object
      返回:
      the size
    • toURI

      public static URI toURI(String name)
      To URI.
      参数:
      name - the name
      返回:
      the uri
    • getGenericClass

      public static Class<?> getGenericClass(Class<?> cls)
      Gets the generic class.
      参数:
      cls - the cls
      返回:
      the generic class
    • getGenericClass

      public static Class<?> getGenericClass(Class<?> cls, int i)
      Gets the generic class.
      参数:
      cls - the cls
      i - the i
      返回:
      the generic class
    • isBeforeJava5

      public static boolean isBeforeJava5(String javaVersion)
      Checks if is before java 5.
      参数:
      javaVersion - the java version
      返回:
      true, if is before java 5
    • isBeforeJava6

      public static boolean isBeforeJava6(String javaVersion)
      Checks if is before java 6.
      参数:
      javaVersion - the java version
      返回:
      true, if is before java 6
    • toString

      public static String toString(Throwable e)
      To string.
      参数:
      e - the e
      返回:
      the string
    • checkBytecode

      public static void checkBytecode(String name, byte[] bytecode)
      Check bytecode.
      参数:
      name - the name
      bytecode - the bytecode
    • getSizeMethod

      public static String getSizeMethod(Class<?> cls)
      Gets the size method.
      参数:
      cls - the cls
      返回:
      the size method
    • getMethodName

      public static String getMethodName(Method method, Class<?>[] parameterClasses, String rightCode)
      Gets the method name.
      参数:
      method - the method
      parameterClasses - the parameter classes
      rightCode - the right code
      返回:
      the method name
    • searchMethod

      public static Method searchMethod(Class<?> currentClass, String name, Class<?>[] parameterTypes) throws NoSuchMethodException
      Search method.
      参数:
      currentClass - the current class
      name - the name
      parameterTypes - the parameter types
      返回:
      the method
      抛出:
      NoSuchMethodException - the no such method exception
    • getInitCode

      public static String getInitCode(Class<?> type)
      Gets the inits the code.
      参数:
      type - the type
      返回:
      the inits the code
    • toMap

      public static <K, V> Map<K,V> toMap(Map.Entry<K,V>[] entries)
      To map.
      类型参数:
      K - the key type
      V - the value type
      参数:
      entries - the entries
      返回:
      the map