本文整理汇总了Java中org.apache.ibatis.reflection.typeparam.Level2Mapper类的典型用法代码示例。如果您正苦于以下问题:Java Level2Mapper类的具体用法?Java Level2Mapper怎么用?Java Level2Mapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Level2Mapper类属于org.apache.ibatis.reflection.typeparam包,在下文中一共展示了Level2Mapper类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReturn_Lv2CustomClass
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testReturn_Lv2CustomClass() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("selectCalculator", Calculator.class);
Type result = TypeParameterResolver.resolveReturnType(method, clazz);
assertTrue(result instanceof ParameterizedType);
ParameterizedType paramType = (ParameterizedType) result;
assertEquals(Calculator.class, paramType.getRawType());
assertEquals(1, paramType.getActualTypeArguments().length);
assertEquals(String.class, paramType.getActualTypeArguments()[0]);
}
示例2: testReturn_Lv2CustomClassList
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testReturn_Lv2CustomClassList() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("selectCalculatorList");
Type result = TypeParameterResolver.resolveReturnType(method, clazz);
assertTrue(result instanceof ParameterizedType);
ParameterizedType paramTypeOuter = (ParameterizedType) result;
assertEquals(List.class, paramTypeOuter.getRawType());
assertEquals(1, paramTypeOuter.getActualTypeArguments().length);
ParameterizedType paramTypeInner = (ParameterizedType) paramTypeOuter.getActualTypeArguments()[0];
assertEquals(Calculator.class, paramTypeInner.getRawType());
assertEquals(Date.class, paramTypeInner.getActualTypeArguments()[0]);
}
示例3: testReturn_Lv2Class
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testReturn_Lv2Class() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("select", Object.class);
Type result = TypeParameterResolver.resolveReturnType(method, clazz);
assertEquals(String.class, result);
}
示例4: testReturn_Lv2ArrayOfArray
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testReturn_Lv2ArrayOfArray() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("selectArrayOfArray");
Type result = TypeParameterResolver.resolveReturnType(method, clazz);
assertTrue(result instanceof Class);
Class<?> resultClass = (Class<?>) result;
assertTrue(result instanceof Class);
assertTrue(resultClass.isArray());
assertTrue(resultClass.getComponentType().isArray());
assertEquals(String.class, resultClass.getComponentType().getComponentType());
}
示例5: testReturn_Lv2ArrayOfList
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testReturn_Lv2ArrayOfList() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("selectArrayOfList");
Type result = TypeParameterResolver.resolveReturnType(method, clazz);
assertTrue(result instanceof GenericArrayType);
GenericArrayType genericArrayType = (GenericArrayType) result;
assertTrue(genericArrayType.getGenericComponentType() instanceof ParameterizedType);
ParameterizedType paramType = (ParameterizedType) genericArrayType.getGenericComponentType();
assertEquals(List.class, paramType.getRawType());
assertEquals(String.class, paramType.getActualTypeArguments()[0]);
}
示例6: testReturn_Lv2WildcardList
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testReturn_Lv2WildcardList() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("selectWildcardList");
Type result = TypeParameterResolver.resolveReturnType(method, clazz);
assertTrue(result instanceof ParameterizedType);
ParameterizedType type = (ParameterizedType) result;
assertEquals(List.class, type.getRawType());
assertEquals(1, type.getActualTypeArguments().length);
assertTrue(type.getActualTypeArguments()[0] instanceof WildcardType);
WildcardType wildcard = (WildcardType) type.getActualTypeArguments()[0];
assertEquals(0, wildcard.getLowerBounds().length);
assertEquals(1, wildcard.getUpperBounds().length);
assertEquals(String.class, wildcard.getUpperBounds()[0]);
}
示例7: testReturn_LV2Map
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testReturn_LV2Map() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("selectMap");
Type result = TypeParameterResolver.resolveReturnType(method, clazz);
assertTrue(result instanceof ParameterizedType);
ParameterizedType paramType = (ParameterizedType) result;
assertEquals(Map.class, paramType.getRawType());
assertEquals(2, paramType.getActualTypeArguments().length);
assertEquals(String.class, paramType.getActualTypeArguments()[0]);
assertEquals(Integer.class, paramType.getActualTypeArguments()[1]);
}
示例8: testParam_Primitive
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testParam_Primitive() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("simpleSelectPrimitive", int.class);
Type[] result = TypeParameterResolver.resolveParamTypes(method, clazz);
assertEquals(1, result.length);
assertEquals(int.class, result[0]);
}
示例9: testParam_Lv2Single
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testParam_Lv2Single() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("select", Object.class);
Type[] result = TypeParameterResolver.resolveParamTypes(method, clazz);
assertEquals(1, result.length);
assertEquals(String.class, result[0]);
}
示例10: testParam_Lv2Multiple
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testParam_Lv2Multiple() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("selectList", Object.class, Object.class);
Type[] result = TypeParameterResolver.resolveParamTypes(method, clazz);
assertEquals(2, result.length);
assertEquals(Integer.class, result[0]);
assertEquals(String.class, result[1]);
}
示例11: testParam_Lv2CustomClass
import org.apache.ibatis.reflection.typeparam.Level2Mapper; //导入依赖的package包/类
@Test
public void testParam_Lv2CustomClass() throws Exception {
Class<?> clazz = Level2Mapper.class;
Method method = clazz.getMethod("selectCalculator", Calculator.class);
Type[] result = TypeParameterResolver.resolveParamTypes(method, clazz);
assertEquals(1, result.length);
assertTrue(result[0] instanceof ParameterizedType);
ParameterizedType paramType = (ParameterizedType) result[0];
assertEquals(Calculator.class, paramType.getRawType());
assertEquals(1, paramType.getActualTypeArguments().length);
assertEquals(String.class, paramType.getActualTypeArguments()[0]);
}