@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public @interface TypeDiscriminator
How to use:
public interface UserMapper { @Select("SELECT id, name, type FROM users ORDER BY id") @TypeDiscriminator( column = "type", javaType = String.class, cases = { @Case(value = "1", type = PremiumUser.class), @Case(value = "2", type = GeneralUser.class), @Case(value = "3", type = TemporaryUser.class) } ) List<User> selectAll(); }
Modifier and Type | Required Element and Description |
---|---|
Case[] |
cases
Returns conditional mapping definitions.
|
String |
column
Returns the column name(column label) that hold conditional value.
|
Modifier and Type | Optional Element and Description |
---|---|
Class<?> |
javaType
Return the java type for conditional value.
|
JdbcType |
jdbcType
Return the jdbc type for column that hold conditional value.
|
Class<? extends TypeHandler> |
typeHandler
Returns the
TypeHandler type for retrieving a column value from result set. |
public abstract String column
public abstract Case[] cases
public abstract Class<?> javaType
public abstract JdbcType jdbcType
public abstract Class<? extends TypeHandler> typeHandler
TypeHandler
type for retrieving a column value from result set.TypeHandler
typeCopyright © 2009–2024. All rights reserved.