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

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

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

Configuration.newMetaObject介绍

暂无

代码示例

代码示例来源:origin: baomidou/mybatis-plus

private <E> Object convertToDeclaredCollection(Configuration config, List<E> list) {
  Object collection = config.getObjectFactory().create(method.getReturnType());
  MetaObject metaObject = config.newMetaObject(collection);
  metaObject.addAll(list);
  return collection;
}

代码示例来源:origin: wuyouzhuguli/FEBS-Shiro

MetaObject metaObject = configuration.newMetaObject(parameterObject);
for (ParameterMapping parameterMapping : parameterMappings) {
  String propertyName = parameterMapping.getProperty();

代码示例来源:origin: abel533/Mapper

String[] keyProperties = keyStatement.getKeyProperties();
final Configuration configuration = ms.getConfiguration();
final MetaObject metaParam = configuration.newMetaObject(parameter);
if (keyProperties != null) {
    throw new ExecutorException("SelectKey returned more than one value.");
  } else {
    MetaObject metaResult = configuration.newMetaObject(values.get(0));
    if (keyProperties.length == 1) {
      if (metaResult.hasGetter(keyProperties[0])) {

代码示例来源:origin: abel533/Mapper

String[] keyProperties = keyStatement.getKeyProperties();
final Configuration configuration = ms.getConfiguration();
final MetaObject metaParam = configuration.newMetaObject(parameter);
if (keyProperties != null) {
    throw new ExecutorException("SelectKey returned more than one value.");
  } else {
    MetaObject metaResult = configuration.newMetaObject(values.get(0));
    if (keyProperties.length == 1) {
      if (metaResult.hasGetter(keyProperties[0])) {

代码示例来源:origin: baomidou/mybatis-plus

value = parameterObject;
} else {
  MetaObject metaObject = configuration.newMetaObject(parameterObject);
  value = metaObject.getValue(propertyName);

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

public ParameterMappingTokenHandler(Configuration configuration, Class<?> parameterType, Map<String, Object> additionalParameters) {
 super(configuration);
 this.parameterType = parameterType;
 this.metaParameters = configuration.newMetaObject(additionalParameters);
}

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

public ParameterMappingTokenHandler(Configuration configuration, Class<?> parameterType, Map<String, Object> additionalParameters) {
 super(configuration);
 this.parameterType = parameterType;
 this.metaParameters = configuration.newMetaObject(additionalParameters);
}

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

public BoundSql(Configuration configuration, String sql, List<ParameterMapping> parameterMappings, Object parameterObject) {
 this.sql = sql;
 this.parameterMappings = parameterMappings;
 this.parameterObject = parameterObject;
 this.additionalParameters = new HashMap<String, Object>();
 this.metaParameters = configuration.newMetaObject(additionalParameters);
}

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

public BoundSql(Configuration configuration, String sql, List<ParameterMapping> parameterMappings, Object parameterObject) {
 this.sql = sql;
 this.parameterMappings = parameterMappings;
 this.parameterObject = parameterObject;
 this.additionalParameters = new HashMap<>();
 this.metaParameters = configuration.newMetaObject(additionalParameters);
}

代码示例来源:origin: baomidou/mybatis-plus

MetaObject metaObject = ms.getConfiguration().newMetaObject(parameterObject);

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

private void linkObjects(MetaObject metaObject, ResultMapping resultMapping, Object rowValue) {
 final Object collectionProperty = instantiateCollectionPropertyIfAppropriate(resultMapping, metaObject);
 if (collectionProperty != null) {
  final MetaObject targetMetaObject = configuration.newMetaObject(collectionProperty);
  targetMetaObject.add(rowValue);
 } else {
  metaObject.setValue(resultMapping.getProperty(), rowValue);
 }
}

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

private <E> Object convertToDeclaredCollection(Configuration config, List<E> list) {
 Object collection = config.getObjectFactory().create(method.getReturnType());
 MetaObject metaObject = config.newMetaObject(collection);
 metaObject.addAll(list);
 return collection;
}

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

private void linkObjects(MetaObject metaObject, ResultMapping resultMapping, Object rowValue) {
 final Object collectionProperty = instantiateCollectionPropertyIfAppropriate(resultMapping, metaObject);
 if (collectionProperty != null) {
  final MetaObject targetMetaObject = configuration.newMetaObject(collectionProperty);
  targetMetaObject.add(rowValue);
 } else {
  metaObject.setValue(resultMapping.getProperty(), rowValue);
 }
}

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

private <E> Object convertToDeclaredCollection(Configuration config, List<E> list) {
 Object collection = config.getObjectFactory().create(method.getReturnType());
 MetaObject metaObject = config.newMetaObject(collection);
 metaObject.addAll(list);
 return collection;
}

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

private void handleLocallyCachedOutputParameters(MappedStatement ms, CacheKey key, Object parameter, BoundSql boundSql) {
 if (ms.getStatementType() == StatementType.CALLABLE) {
  final Object cachedParameter = localOutputParameterCache.getObject(key);
  if (cachedParameter != null && parameter != null) {
   final MetaObject metaCachedParameter = configuration.newMetaObject(cachedParameter);
   final MetaObject metaParameter = configuration.newMetaObject(parameter);
   for (ParameterMapping parameterMapping : boundSql.getParameterMappings()) {
    if (parameterMapping.getMode() != ParameterMode.IN) {
     final String parameterName = parameterMapping.getProperty();
     final Object cachedValue = metaCachedParameter.getValue(parameterName);
     metaParameter.setValue(parameterName, cachedValue);
    }
   }
  }
 }
}

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

public DynamicContext(Configuration configuration, Object parameterObject) {
 if (parameterObject != null && !(parameterObject instanceof Map)) {
  MetaObject metaObject = configuration.newMetaObject(parameterObject);
  bindings = new ContextMap(metaObject);
 } else {
  bindings = new ContextMap(null);
 }
 bindings.put(PARAMETER_OBJECT_KEY, parameterObject);
 bindings.put(DATABASE_ID_KEY, configuration.getDatabaseId());
}

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

public DynamicContext(Configuration configuration, Object parameterObject) {
 if (parameterObject != null && !(parameterObject instanceof Map)) {
  MetaObject metaObject = configuration.newMetaObject(parameterObject);
  bindings = new ContextMap(metaObject);
 } else {
  bindings = new ContextMap(null);
 }
 bindings.put(PARAMETER_OBJECT_KEY, parameterObject);
 bindings.put(DATABASE_ID_KEY, configuration.getDatabaseId());
}

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

private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap) throws SQLException {
 final ResultLoaderMap lazyLoader = new ResultLoaderMap();
 Object rowValue = createResultObject(rsw, resultMap, lazyLoader, null);
 if (rowValue != null && !hasTypeHandlerForResultObject(rsw, resultMap.getType())) {
  final MetaObject metaObject = configuration.newMetaObject(rowValue);
  boolean foundValues = this.useConstructorMappings;
  if (shouldApplyAutomaticMappings(resultMap, false)) {
   foundValues = applyAutomaticMappings(rsw, resultMap, metaObject, null) || foundValues;
  }
  foundValues = applyPropertyMappings(rsw, resultMap, metaObject, lazyLoader, null) || foundValues;
  foundValues = lazyLoader.size() > 0 || foundValues;
  rowValue = (foundValues || configuration.isReturnInstanceForEmptyRow()) ? rowValue : null;
 }
 return rowValue;
}

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

private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap, String columnPrefix) throws SQLException {
 final ResultLoaderMap lazyLoader = new ResultLoaderMap();
 Object rowValue = createResultObject(rsw, resultMap, lazyLoader, columnPrefix);
 if (rowValue != null && !hasTypeHandlerForResultObject(rsw, resultMap.getType())) {
  final MetaObject metaObject = configuration.newMetaObject(rowValue);
  boolean foundValues = this.useConstructorMappings;
  if (shouldApplyAutomaticMappings(resultMap, false)) {
   foundValues = applyAutomaticMappings(rsw, resultMap, metaObject, columnPrefix) || foundValues;
  }
  foundValues = applyPropertyMappings(rsw, resultMap, metaObject, lazyLoader, columnPrefix) || foundValues;
  foundValues = lazyLoader.size() > 0 || foundValues;
  rowValue = foundValues || configuration.isReturnInstanceForEmptyRow() ? rowValue : null;
 }
 return rowValue;
}

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

private Object prepareCompositeKeyParameter(ResultSet rs, ResultMapping resultMapping, Class<?> parameterType, String columnPrefix) throws SQLException {
 final Object parameterObject = instantiateParameterObject(parameterType);
 final MetaObject metaObject = configuration.newMetaObject(parameterObject);
 boolean foundValues = false;
 for (ResultMapping innerResultMapping : resultMapping.getComposites()) {
  final Class<?> propType = metaObject.getSetterType(innerResultMapping.getProperty());
  final TypeHandler<?> typeHandler = typeHandlerRegistry.getTypeHandler(propType);
  final Object propValue = typeHandler.getResult(rs, prependPrefix(innerResultMapping.getColumn(), columnPrefix));
  // issue #353 & #560 do not execute nested query if key is null
  if (propValue != null) {
   metaObject.setValue(innerResultMapping.getProperty(), propValue);
   foundValues = true;
  }
 }
 return foundValues ? parameterObject : null;
}

相关文章

Configuration类方法