org.apache.ibatis.session.Configuration.getReflectorFactory()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.apache.ibatis.session.Configuration.getReflectorFactory()方法的一些代码示例,展示了Configuration.getReflectorFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getReflectorFactory()方法的具体详情如下:
包路径:org.apache.ibatis.session.Configuration
类名称:Configuration
方法名:getReflectorFactory

Configuration.getReflectorFactory介绍

暂无

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

private Class<?> resolveResultJavaType(Class<?> resultType, String property, Class<?> javaType) {
 if (javaType == null && property != null) {
  try {
   MetaClass metaResultType = MetaClass.forClass(resultType, configuration.getReflectorFactory());
   javaType = metaResultType.getSetterType(property);
  } catch (Exception e) {
   //ignore, following null check statement will deal with the situation
  }
 }
 if (javaType == null) {
  javaType = Object.class;
 }
 return javaType;
}

代码示例来源:origin: org.mybatis/mybatis

private Class<?> resolveResultJavaType(Class<?> resultType, String property, Class<?> javaType) {
 if (javaType == null && property != null) {
  try {
   MetaClass metaResultType = MetaClass.forClass(resultType, configuration.getReflectorFactory());
   javaType = metaResultType.getSetterType(property);
  } catch (Exception e) {
   //ignore, following null check statement will deal with the situation
  }
 }
 if (javaType == null) {
  javaType = Object.class;
 }
 return javaType;
}

代码示例来源:origin: org.mybatis/mybatis

private Class<?> resolveParameterJavaType(Class<?> resultType, String property, Class<?> javaType, JdbcType jdbcType) {
 if (javaType == null) {
  if (JdbcType.CURSOR.equals(jdbcType)) {
   javaType = java.sql.ResultSet.class;
  } else if (Map.class.isAssignableFrom(resultType)) {
   javaType = Object.class;
  } else {
   MetaClass metaResultType = MetaClass.forClass(resultType, configuration.getReflectorFactory());
   javaType = metaResultType.getGetterType(property);
  }
 }
 if (javaType == null) {
  javaType = Object.class;
 }
 return javaType;
}

代码示例来源:origin: camunda/camunda-bpm-platform

private Class<?> resolveParameterJavaType(Class<?> resultType, String property, Class<?> javaType, JdbcType jdbcType) {
 if (javaType == null) {
  if (JdbcType.CURSOR.equals(jdbcType)) {
   javaType = java.sql.ResultSet.class;
  } else if (Map.class.isAssignableFrom(resultType)) {
   javaType = Object.class;
  } else {
   MetaClass metaResultType = MetaClass.forClass(resultType, configuration.getReflectorFactory());
   javaType = metaResultType.getGetterType(property);
  }
 }
 if (javaType == null) {
  javaType = Object.class;
 }
 return javaType;
}

代码示例来源:origin: org.mybatis/mybatis

public DefaultResultSetHandler(Executor executor, MappedStatement mappedStatement, ParameterHandler parameterHandler, ResultHandler<?> resultHandler, BoundSql boundSql,
                RowBounds rowBounds) {
 this.executor = executor;
 this.configuration = mappedStatement.getConfiguration();
 this.mappedStatement = mappedStatement;
 this.rowBounds = rowBounds;
 this.parameterHandler = parameterHandler;
 this.boundSql = boundSql;
 this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
 this.objectFactory = configuration.getObjectFactory();
 this.reflectorFactory = configuration.getReflectorFactory();
 this.resultHandler = resultHandler;
}

代码示例来源:origin: org.mybatis/mybatis

protected Class<?> inheritEnclosingType(XNode resultMapNode, Class<?> enclosingType) {
 if ("association".equals(resultMapNode.getName()) && resultMapNode.getStringAttribute("resultMap") == null) {
  String property = resultMapNode.getStringAttribute("property");
  if (property != null && enclosingType != null) {
   MetaClass metaResultType = MetaClass.forClass(enclosingType, configuration.getReflectorFactory());
   return metaResultType.getSetterType(property);
  }
 } else if ("case".equals(resultMapNode.getName()) && resultMapNode.getStringAttribute("resultMap") == null) {
  return enclosingType;
 }
 return null;
}

代码示例来源:origin: camunda/camunda-bpm-platform

public DefaultResultSetHandler(Executor executor, MappedStatement mappedStatement, ParameterHandler parameterHandler, ResultHandler<?> resultHandler, BoundSql boundSql,
                RowBounds rowBounds) {
 this.executor = executor;
 this.configuration = mappedStatement.getConfiguration();
 this.mappedStatement = mappedStatement;
 this.rowBounds = rowBounds;
 this.parameterHandler = parameterHandler;
 this.boundSql = boundSql;
 this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
 this.objectFactory = configuration.getObjectFactory();
 this.reflectorFactory = configuration.getReflectorFactory();
 this.resultHandler = resultHandler;
 this.primitiveTypes = new PrimitiveTypes();
}

代码示例来源:origin: org.mybatis/mybatis

protected void validateCollection(XNode context, Class<?> enclosingType) {
 if ("collection".equals(context.getName()) && context.getStringAttribute("resultMap") == null
  && context.getStringAttribute("resultType") == null) {
  MetaClass metaResultType = MetaClass.forClass(enclosingType, configuration.getReflectorFactory());
  String property = context.getStringAttribute("property");
  if (!metaResultType.hasSetter(property)) {
   throw new BuilderException(
    "Ambiguous collection type for property '" + property + "'. You must specify 'resultType' or 'resultMap'.");
  }
 }
}

代码示例来源:origin: org.mybatis/mybatis

propertyType = Object.class;
} else {
 MetaClass metaClass = MetaClass.forClass(parameterType, configuration.getReflectorFactory());
 if (metaClass.hasGetter(property)) {
  propertyType = metaClass.getGetterType(property);

代码示例来源:origin: camunda/camunda-bpm-platform

propertyType = java.sql.ResultSet.class;
} else if (property != null) {
 MetaClass metaClass = MetaClass.forClass(parameterType, configuration.getReflectorFactory());
 if (metaClass.hasGetter(property)) {
  propertyType = metaClass.getGetterType(property);

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowBounds) {
 final List<? extends V> list = selectList(statement, parameter, rowBounds);
 final DefaultMapResultHandler<K, V> mapResultHandler = new DefaultMapResultHandler<K, V>(mapKey,
   configuration.getObjectFactory(), configuration.getObjectWrapperFactory(), configuration.getReflectorFactory());
 final DefaultResultContext<V> context = new DefaultResultContext<V>();
 for (V o : list) {
  context.nextResultObject(o);
  mapResultHandler.handleResult(context);
 }
 return mapResultHandler.getMappedResults();
}

代码示例来源:origin: org.mybatis/mybatis

@Override
public <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowBounds) {
 final List<? extends V> list = selectList(statement, parameter, rowBounds);
 final DefaultMapResultHandler<K, V> mapResultHandler = new DefaultMapResultHandler<>(mapKey,
     configuration.getObjectFactory(), configuration.getObjectWrapperFactory(), configuration.getReflectorFactory());
 final DefaultResultContext<V> context = new DefaultResultContext<>();
 for (V o : list) {
  context.nextResultObject(o);
  mapResultHandler.handleResult(context);
 }
 return mapResultHandler.getMappedResults();
}

相关文章

Configuration类方法