if ((CommunicationPatternType.SIMPLE_RESPONSE == communicationPattern)
|| ((CommunicationPatternType.MULTIPLE_BATCH_RESPONSE == communicationPattern) && (0 == lHowmany))) // 获取全部
{
nbiFirstBackupList = iter.getAll();
}
else if (CommunicationPatternType.MULTIPLE_BATCH_RESPONSE == communicationPattern)// 分批获取
{
nbiFirstBackupList = iter
.getFirst(BigInteger.valueOf(lHowmany));
}
上面这段代正确吗? 没有else .我在想如果它既不走if 也不走else if ,那不就要报错了?
有if ,也有else if 没有else 那这种判断会不会有缺陷啊?我觉得好像有点不合理。
哦发出来发现我写错了...你的那个写法
应该是 if(){} if(){} 中间就不要else 里..不过按照你的那么写也不会报错..但是逻辑不清楚了
不会报错..如果不走else 也不走elseif那么你的[code="java" if ((CommunicationPatternType.SIMPLE_RESPONSE == communicationPattern)
|| ((CommunicationPatternType.MULTIPLE_BATCH_RESPONSE == communicationPattern) ][/code]
这个条件都走不进去
应该这么写吧我觉得
[code="java"]
if ((0 == lHowmany) // 获取全部
{
nbiFirstBackupList = iter.getAll();
}
else if (CommunicationPatternType.MULTIPLE_BATCH_RESPONSE == communicationPattern)// 分批获取
{
nbiFirstBackupList = iter
.getFirst(BigInteger.valueOf(lHowmany));
}
[/code]