Search in sources :

Example 1 with TypeDiscriminator

use of org.apache.ibatis.annotations.TypeDiscriminator in project mybatis-3 by mybatis.

the class MapperAnnotationBuilder method applyResultMap.

private void applyResultMap(String resultMapId, Class<?> returnType, Arg[] args, Result[] results, TypeDiscriminator discriminator) {
    List<ResultMapping> resultMappings = new ArrayList<ResultMapping>();
    applyConstructorArgs(args, returnType, resultMappings);
    applyResults(results, returnType, resultMappings);
    Discriminator disc = applyDiscriminator(resultMapId, returnType, discriminator);
    // TODO add AutoMappingBehaviour
    assistant.addResultMap(resultMapId, returnType, null, disc, resultMappings, null);
    createDiscriminatorResultMaps(resultMapId, returnType, discriminator);
}
Also used : ResultMapping(org.apache.ibatis.mapping.ResultMapping) ArrayList(java.util.ArrayList) TypeDiscriminator(org.apache.ibatis.annotations.TypeDiscriminator) Discriminator(org.apache.ibatis.mapping.Discriminator)

Example 2 with TypeDiscriminator

use of org.apache.ibatis.annotations.TypeDiscriminator in project mybatis-3 by mybatis.

the class MapperAnnotationBuilder method parseResultMap.

private String parseResultMap(Method method) {
    Class<?> returnType = getReturnType(method);
    ConstructorArgs args = method.getAnnotation(ConstructorArgs.class);
    Results results = method.getAnnotation(Results.class);
    TypeDiscriminator typeDiscriminator = method.getAnnotation(TypeDiscriminator.class);
    String resultMapId = generateResultMapName(method);
    applyResultMap(resultMapId, returnType, argsIf(args), resultsIf(results), typeDiscriminator);
    return resultMapId;
}
Also used : TypeDiscriminator(org.apache.ibatis.annotations.TypeDiscriminator) ConstructorArgs(org.apache.ibatis.annotations.ConstructorArgs) Results(org.apache.ibatis.annotations.Results)

Aggregations

TypeDiscriminator (org.apache.ibatis.annotations.TypeDiscriminator)2 ArrayList (java.util.ArrayList)1 ConstructorArgs (org.apache.ibatis.annotations.ConstructorArgs)1 Results (org.apache.ibatis.annotations.Results)1 Discriminator (org.apache.ibatis.mapping.Discriminator)1 ResultMapping (org.apache.ibatis.mapping.ResultMapping)1