List of usage examples for org.apache.ibatis.type TypeAliasRegistry resolveAlias
@SuppressWarnings("unchecked") public <T> Class<T> resolveAlias(String string)
From source file:org.mybatis.spring.SqlSessionFactoryBeanTest.java
License:Apache License
@Test public void testAddATypeAlias() throws Exception { setupFactoryBean();/*w w w. j a v a 2 s . c o m*/ factoryBean.setTypeAliases(new Class[] { DummyTypeAlias.class }); TypeAliasRegistry typeAliasRegistry = factoryBean.getObject().getConfiguration().getTypeAliasRegistry(); typeAliasRegistry.resolveAlias("testAlias"); }
From source file:org.mybatis.spring.SqlSessionFactoryBeanTest.java
License:Apache License
@Test public void testSearchATypeAliasPackage() throws Exception { setupFactoryBean();// w w w . j a va 2 s. c om factoryBean.setTypeAliasesPackage("org/mybatis/spring/type"); TypeAliasRegistry typeAliasRegistry = factoryBean.getObject().getConfiguration().getTypeAliasRegistry(); typeAliasRegistry.resolveAlias("testAlias"); typeAliasRegistry.resolveAlias("testAlias2"); typeAliasRegistry.resolveAlias("dummyTypeHandler"); typeAliasRegistry.resolveAlias("superType"); }
From source file:org.mybatis.spring.SqlSessionFactoryBeanTest.java
License:Apache License
@Test public void testSearchATypeAliasPackageWithSuperType() throws Exception { setupFactoryBean();/*from w w w.ja v a 2 s .c o m*/ factoryBean.setTypeAliasesSuperType(SuperType.class); factoryBean.setTypeAliasesPackage("org/mybatis/spring/type"); TypeAliasRegistry typeAliasRegistry = factoryBean.getObject().getConfiguration().getTypeAliasRegistry(); typeAliasRegistry.resolveAlias("testAlias2"); typeAliasRegistry.resolveAlias("superType"); try { typeAliasRegistry.resolveAlias("testAlias"); fail(); } catch (TypeException e) { // expected } try { typeAliasRegistry.resolveAlias("dummyTypeHandler"); fail(); } catch (TypeException e) { // expected } }