Search in sources :

Example 1 with Results

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

the class MapperAnnotationBuilder method generateResultMapName.

private String generateResultMapName(Method method) {
    Results results = method.getAnnotation(Results.class);
    if (results != null && !results.id().isEmpty()) {
        return type.getName() + "." + results.id();
    }
    StringBuilder suffix = new StringBuilder();
    for (Class<?> c : method.getParameterTypes()) {
        suffix.append("-");
        suffix.append(c.getSimpleName());
    }
    if (suffix.length() < 1) {
        suffix.append("-void");
    }
    return type.getName() + "." + method.getName() + suffix;
}
Also used : Results(org.apache.ibatis.annotations.Results)

Example 2 with Results

use of org.apache.ibatis.annotations.Results 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

Results (org.apache.ibatis.annotations.Results)2 ConstructorArgs (org.apache.ibatis.annotations.ConstructorArgs)1 TypeDiscriminator (org.apache.ibatis.annotations.TypeDiscriminator)1