Example usage for org.apache.ibatis.plugin Invocation Invocation

List of usage examples for org.apache.ibatis.plugin Invocation Invocation

Introduction

In this page you can find the example usage for org.apache.ibatis.plugin Invocation Invocation.

Prototype

public Invocation(Object target, Method method, Object[] args) 

Source Link

Usage

From source file:cn.com.bricks.mybatis.rbac.DynamicObscureInterceptorNGTest.java

/**
 * intercept (DynamicObscureInterceptor)
 *//* www. ja  v  a2 s  .c o m*/
@Test
public void testIntercept() throws Exception, Throwable {
    System.out.println("intercept");
    Invocation invocation = new Invocation(this, null, null) {
        @Override
        public Object proceed() throws InvocationTargetException, IllegalAccessException {
            List<DomainBean> domains = new ArrayList<DomainBean>();
            DomainBean domain = new DomainBean(11, "14552.00", "100241-00");
            domain.setPhone("13511111111");
            domain.setName("");
            domains.add(domain);
            return domains;
        }

    };
    DynamicObscureInterceptor instance = new DynamicObscureInterceptor();
    //Object expResult = null;
    Object result = instance.intercept(invocation);
    System.out.println(result);
    //        assertEquals(result, expResult);
    // TODO ??
}

From source file:com.fjn.helper.frameworkex.mybatis.plugin.PluginEnhancement.java

License:Apache License

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    try {// w w  w  .j ava  2  s  . c o m
        Set<Method> methods = signatureMap.get(method.getDeclaringClass());
        if (methods != null && methods.contains(method)) {
            return interceptor.intercept(new Invocation(target, method, args));
        }
        return method.invoke(target, args);
    } catch (Exception e) {
        throw ExceptionUtil.unwrapThrowable(e);
    }
}