コード例 #1
0
 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
   if (isObjectMethod(method)) {
     return null;
   }
   final Class<?> declaringInterface = findDeclaringInterface(proxy, method);
   if (Pager.class.isAssignableFrom(method.getReturnType())) {
     return new MyBatisMapperMethod(
             getDeclaringInterface(declaringInterface, method), method, this.sqlSession)
         .execute(args);
   }
   MapperMethod mapperMethod =
       new MapperMethod(
           getDeclaringInterface(declaringInterface, method),
           method,
           this.sqlSession.getConfiguration());
   Object result = mapperMethod.execute(this.sqlSession, args);
   if ((result == null) && (method.getReturnType().isPrimitive())) {
     throw new BindingException(
         "Mapper method '"
             + method.getName()
             + "' ("
             + method.getDeclaringClass()
             + ") attempted to return null from a method with a primitive return type ("
             + method.getReturnType()
             + ").");
   }
   return result;
 }
コード例 #2
0
 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
   if (Object.class.equals(method.getDeclaringClass())) {
     try {
       return method.invoke(this, args);
     } catch (Throwable t) {
       throw ExceptionUtil.unwrapThrowable(t);
     }
   }
   final MapperMethod mapperMethod = cachedMapperMethod(method);
   return mapperMethod.execute(sqlSession, args);
 }