diff --git a/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java b/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java index d9b349ab7c1..a0d802f3d19 100644 --- a/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java +++ b/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java @@ -462,7 +462,7 @@ private void applyResults(Result[] results, Class resultType, List 0 && result.many().resultMap().length() > 0) { + if (!result.one().resultMap().isEmpty() && !result.many().resultMap().isEmpty()) { throw new BuilderException("Cannot use both @One and @Many annotations in the same @Result"); } - return result.one().resultMap().length() > 0 || result.many().resultMap().length() > 0; + return !result.one().resultMap().isEmpty() || !result.many().resultMap().isEmpty(); } private String nestedSelectId(Result result) { String nestedSelect = result.one().select(); - if (nestedSelect.length() < 1) { + if (nestedSelect.isEmpty()) { nestedSelect = result.many().select(); } if (!nestedSelect.contains(".")) { @@ -499,19 +499,19 @@ private String nestedSelectId(Result result) { private boolean isLazy(Result result) { boolean isLazy = configuration.isLazyLoadingEnabled(); - if (result.one().select().length() > 0 && FetchType.DEFAULT != result.one().fetchType()) { + if (!result.one().select().isEmpty() && FetchType.DEFAULT != result.one().fetchType()) { isLazy = result.one().fetchType() == FetchType.LAZY; - } else if (result.many().select().length() > 0 && FetchType.DEFAULT != result.many().fetchType()) { + } else if (!result.many().select().isEmpty() && FetchType.DEFAULT != result.many().fetchType()) { isLazy = result.many().fetchType() == FetchType.LAZY; } return isLazy; } private boolean hasNestedSelect(Result result) { - if (result.one().select().length() > 0 && result.many().select().length() > 0) { + if (!result.one().select().isEmpty() && !result.many().select().isEmpty()) { throw new BuilderException("Cannot use both @One and @Many annotations in the same @Result"); } - return result.one().select().length() > 0 || result.many().select().length() > 0; + return !result.one().select().isEmpty() || !result.many().select().isEmpty(); } private void applyConstructorArgs(Arg[] args, Class resultType, List resultMappings, @@ -539,7 +539,7 @@ private void applyConstructorArgs(Arg[] args, Class resultType, List