Ejemplo n.º 1
0
 public MethodSignature(Configuration configuration, Method method) throws BindingException {
   this.returnType = method.getReturnType();
   this.returnsVoid = void.class.equals(this.returnType);
   this.returnsMany =
       (configuration.getObjectFactory().isCollection(this.returnType)
           || this.returnType.isArray());
   this.mapKey = getMapKey(method);
   this.returnsMap = (this.mapKey != null);
   this.hasNamedParameters = hasNamedParams(method);
   this.rowBoundsIndex = getUniqueParamIndex(method, RowBounds.class);
   this.resultHandlerIndex = getUniqueParamIndex(method, ResultHandler.class);
   this.params = Collections.unmodifiableSortedMap(getParams(method, this.hasNamedParameters));
 }
Ejemplo n.º 2
0
 public DeferredLoad(
     MappedStatement mappedStatement,
     MetaObject resultObject,
     String property,
     CacheKey key,
     PerpetualCache localCache,
     Configuration configuration) {
   this.resultObject = resultObject;
   this.property = property;
   this.key = key;
   this.localCache = localCache;
   this.objectFactory = configuration.getObjectFactory();
   this.configuration = configuration;
 }
 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.resultHandler = resultHandler;
 }
Ejemplo n.º 4
0
 public ResultLoader(
     Configuration config,
     Executor executor,
     MappedStatement mappedStatement,
     Object parameterObject,
     Class<?> targetType,
     CacheKey cacheKey,
     BoundSql boundSql) {
   this.configuration = config;
   this.executor = executor;
   this.mappedStatement = mappedStatement;
   this.parameterObject = parameterObject;
   this.targetType = targetType;
   this.objectFactory = configuration.getObjectFactory();
   this.cacheKey = cacheKey;
   this.boundSql = boundSql;
   this.resultExtractor = new ResultExtractor(configuration, objectFactory);
 }
Ejemplo n.º 5
0
 public MethodSignature(Configuration configuration, Class<?> mapperInterface, Method method) {
   Type resolvedReturnType = TypeParameterResolver.resolveReturnType(method, mapperInterface);
   if (resolvedReturnType instanceof Class<?>) {
     this.returnType = (Class<?>) resolvedReturnType;
   } else if (resolvedReturnType instanceof ParameterizedType) {
     this.returnType = (Class<?>) ((ParameterizedType) resolvedReturnType).getRawType();
   } else {
     this.returnType = method.getReturnType();
   }
   this.returnsVoid = void.class.equals(this.returnType);
   this.returnsMany =
       (configuration.getObjectFactory().isCollection(this.returnType)
           || this.returnType.isArray());
   this.returnsCursor = Cursor.class.equals(this.returnType);
   this.mapKey = getMapKey(method);
   this.returnsMap = (this.mapKey != null);
   this.rowBoundsIndex = getUniqueParamIndex(method, RowBounds.class);
   this.resultHandlerIndex = getUniqueParamIndex(method, ResultHandler.class);
   this.paramNameResolver = new ParamNameResolver(configuration, method);
 }
Ejemplo n.º 6
0
 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;
 }