📄 classutilities.java
字号:
package com.ibm.j2x.util;
/**
* The ClassUtilities class provides helper methods for dealing with java.lang.Class.
*
* @author MAbernethy
*
*/
public class ClassUtilities
{
/**
* Converts the primitive type to its
* corresponding Object type.
* <p><b>Example:</b> passing a <code>int</code> will return <code>Integer</code>.
* @param c the primitive type
* @return the Object type
*/
public static Class convertPrimitiveToObject(Class c)
{
if (c == Boolean.TYPE)
return Boolean.class;
else if (c == Integer.TYPE)
return Integer.class;
else if (c == Double.TYPE)
return Double.class;
else if (c == Float.TYPE)
return Float.class;
else if (c == Short.TYPE)
return Short.class;
else if (c == Long.TYPE)
return Long.class;
else if (c == Character.TYPE)
return Character.class;
else if (c == Byte.TYPE)
return Byte.class;
else if (c == Void.TYPE)
return Void.class;
else
return c;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -