|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.test4j.tools.commons.ClazzHelper
public class ClazzHelper
| 字段摘要 | |
|---|---|
static String |
VALID_PACK_REGULAR
package名称有效字符表达式 |
| 构造方法摘要 | |
|---|---|
ClazzHelper()
|
|
| 方法摘要 | ||
|---|---|---|
static boolean |
classFileExistsInClasspath(String className)
|
|
static
|
createInstanceOfType(String className)
创建className的实例 Creates an instance of the class with the given name. |
|
static boolean |
doesImportSchemaExport()
类路径中是否有 org.hibernate.tool.hbm2ddl.SchemaExport class |
|
static String |
exactBeanName(Method method)
从void setBeanName(Type instance)方法中解析出beanName |
|
static void |
generateClazz(String clazzName,
byte[] r)
|
|
static List<Field> |
getAllFields(Class clazz,
Collection<String> filters,
boolean includeStatic,
boolean includeFinal,
boolean includeTransient)
返回可以class中定义的字段(包含父类定义的) |
|
static byte[] |
getBytes(Class clazz)
读取class的字节码内容byte[] |
|
static
|
getClassForType(Type type)
Gets the class instance for the given type instance. |
|
static
|
getClazz(String className)
Gets the class for the given name. |
|
static
|
getEnumValue(Class<T> enumClass,
String enumValueName)
根据字符串获取枚举值 Gets the enum value that has the given name. |
|
static Type |
getGenericType(Field field)
获得泛型字段的参数类类型 Gets the T from a Class |
|
static String |
getPackageRegex(String regexPackage)
将带有星号的package名称转换为正则表达式 |
|
static String |
getPackFromClassName(String clazzName)
|
|
static String |
getPathFromPath(Class clazz)
根据类名获得package的路径 a.b.c.ImplClazz 返回 "a/b/c" if clazz==null, 返回 "" |
|
static String |
getPathFromPath(String clazzName)
根据类名获得package的路径 a.b.c.ImplClazz 返回 a/b/c |
|
static Object |
getProxiedObject(Object target)
如果是spring代理对象,获得被代理的目标对象 |
|
static Class |
getUnProxyType(Class clazz)
返回非代理类的类型 |
|
static boolean |
isAbstract(Class clazz)
是否是抽象类且非primitive类型 |
|
static boolean |
isAssignable(Type fromType,
Type toType)
Checks whether the given fromType is assignable to the given toType, also taking into account possible auto-boxing. |
|
static boolean |
isClassAvailable(String className)
Utility method that verifies whether the class with the given fully qualified classname is available in the classpath. |
|
static boolean |
isClassFile(String classFileName)
是否是class文件 |
|
static boolean |
isInnerClass(String className)
是否是内部类 |
|
static boolean |
isInterfaceOrAbstract(Class type)
判断类型是否是接口或者抽象类 |
|
static
|
newInstance(Class<T> claz)
创建claz对象实例 不是通过 new Construction()形式 |
|
static
|
newInstance(Class<T> claz,
ConstructorArgsGenerator argGenerator)
|
|
static String |
replaceFileSeparators(String clazzPath)
将class的全路径替换为带.的class名称 ex: convert /a/b.class to a.b |
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
public static final String VALID_PACK_REGULAR
| 构造方法详细信息 |
|---|
public ClazzHelper()
| 方法详细信息 |
|---|
public static boolean isClassAvailable(String className)
className - The name of the class
public static <T> Class<T> getClazz(String className)
className - The name of the class, not null
public static boolean classFileExistsInClasspath(String className)
className - The name of the class to check, not null
public static final boolean doesImportSchemaExport()
public static final String getPackFromClassName(String clazzName)
public static final String getPathFromPath(String clazzName)
clazzName -
public static final String getPathFromPath(Class clazz)
clazzName -
public static final void generateClazz(String clazzName,
byte[] r)
throws IOException
IOExceptionpublic static String getPackageRegex(String regexPackage)
regexPackage - 带有星号的package名称,比如 com.**.service.*Impl
public static boolean isInterfaceOrAbstract(Class type)
type -
public static String exactBeanName(Method method)
method -
public static <T> T createInstanceOfType(String className)
className - The name of the class, not null
Test4JException - if the class could not be found or no instance
could be created
public static boolean isAssignable(Type fromType,
Type toType)
fromType - The from type, not nulltoType - The to type, not null
public static <T extends Enum<?>> T getEnumValue(Class<T> enumClass,
String enumValueName)
enumClass - The enum class, not nullenumValueName - The name of the enum value, not null
Test4JException - if no value could be found with the given namepublic static Type getGenericType(Field field)
field - The field to get the type from, not null
public static <T> Class<T> getClassForType(Type type)
type - The type to get a class instance for, not null
public static byte[] getBytes(Class clazz)
clazz -
public static <T> T newInstance(Class<T> claz)
T - claz -
public static <T> T newInstance(Class<T> claz,
ConstructorArgsGenerator argGenerator)
public static final List<Field> getAllFields(Class clazz,
Collection<String> filters,
boolean includeStatic,
boolean includeFinal,
boolean includeTransient)
clazz - filters - 需要过滤掉的字段includeStatic - 是否包含static修饰的字段includeFinal - 是否包含final修饰的字段includeTransient - 是否包含transient修饰的字段
public static Class getUnProxyType(Class clazz)
type -
public static Object getProxiedObject(Object target)
target -
public static boolean isClassFile(String classFileName)
classFileName -
public static boolean isInnerClass(String className)
className -
public static String replaceFileSeparators(String clazzPath)
clazzPath -
public static boolean isAbstract(Class clazz)
clazz -
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||