congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ClassUtils.getUserClass
Code IndexAdd Tabnine to your IDE (free)

How to use
getUserClass
method
in
com.baomidou.mybatisplus.core.toolkit.ClassUtils

Best Java code snippets using com.baomidou.mybatisplus.core.toolkit.ClassUtils.getUserClass (Showing top 6 results out of 315)

origin: baomidou/mybatis-plus

/**
 * 获取实体映射表信息
 *
 * @param clazz 反射实体类
 * @return 数据库表反射信息
 */
public static TableInfo getTableInfo(Class<?> clazz) {
  if (clazz == null) {
    return null;
  }
  TableInfo tableInfo = TABLE_INFO_CACHE.get(ClassUtils.getUserClass(clazz));
  if (null != tableInfo) {
    return tableInfo;
  }
  //尝试获取父类缓存
  Class currentClass = clazz;
  while (null == tableInfo && Object.class != currentClass) {
    currentClass = currentClass.getSuperclass();
    tableInfo = TABLE_INFO_CACHE.get(ClassUtils.getUserClass(currentClass));
  }
  if (tableInfo != null) {
    TABLE_INFO_CACHE.put(ClassUtils.getUserClass(clazz), tableInfo);
  }
  return tableInfo;
}
origin: baomidou/mybatis-plus

/**
 * 获取当前对象的class
 *
 * @param object 对象
 * @return 返回对象的 user class
 */
public static Class<?> getUserClass(Object object) {
  Assert.notNull(object, "Error: Instance must not be null");
  return getUserClass(object.getClass());
}
origin: baomidou/mybatis-plus

/**
 * 获取该类的所有属性列表
 *
 * @param clazz 反射类
 * @return 属性集合
 */
public static List<Field> getAllFields(Class<?> clazz) {
  List<Field> fieldList = ReflectionKit.getFieldList(ClassUtils.getUserClass(clazz));
  if (CollectionUtils.isNotEmpty(fieldList)) {
    return fieldList.stream()
      .filter(i -> {
        /* 过滤注解非表字段属性 */
        TableField tableField = i.getAnnotation(TableField.class);
        return (tableField == null || tableField.exist());
      }).collect(toList());
  }
  return fieldList;
}
origin: baomidou/mybatis-plus

/**
 * 获取当前的SqlSessionFactory
 *
 * @param clazz 实体类
 */
public static SqlSessionFactory currentSessionFactory(Class<?> clazz) {
  TableInfo tableInfo = TableInfoHelper.getTableInfo(clazz);
  Assert.notNull(tableInfo, ClassUtils.getUserClass(clazz).getName() + " Not Found TableInfoCache.");
  String configMark = tableInfo.getConfigMark();
  GlobalConfig mybatisGlobalConfig = getGlobalConfig(configMark);
  return mybatisGlobalConfig.getSqlSessionFactory();
}
origin: baomidou/mybatis-plus

entityClass = ClassUtils.getUserClass(entityClass.getSuperclass());
tableInfo = TableInfoHelper.getTableInfo(entityClass);
origin: com.baomidou/mybatis-plus-extension

entityClass = ClassUtils.getUserClass(entityClass.getSuperclass());
tableInfo = TableInfoHelper.getTableInfo(entityClass);
com.baomidou.mybatisplus.core.toolkitClassUtilsgetUserClass

Javadoc

获取当前对象的 class

Popular methods of ClassUtils

  • isProxy
  • newInstance
    根据指定的 class , 实例化一个对象,根据构造参数来实例化 在 java9 及其之后的版本 Class.newInstance() 方法已被废弃
  • toClassConfident
    请仅在确定类存在的情况下调用该方法

Popular in Java

  • Finding current android device location
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now