org.apache.wicket.util.lang.Args.withinRange()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.apache.wicket.util.lang.Args.withinRange()方法的一些代码示例,展示了Args.withinRange()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.withinRange()方法的具体详情如下:
包路径:org.apache.wicket.util.lang.Args
类名称:Args
方法名:withinRange

Args.withinRange介绍

[英]Checks if argument is within a range
[中]检查参数是否在范围内

代码示例

代码示例来源:origin: apache/wicket

/**
 * Convenience method that removes <code>count</code> leading segments
 * 
 * @param count
 */
public void removeLeadingSegments(final int count)
{
  Args.withinRange(0, segments.size(), count, "count");
  for (int i = 0; i < count; i++)
  {
    segments.remove(0);
  }
}

代码示例来源:origin: org.apache.wicket/wicket-request

/**
 * Convenience method that removes <code>count</code> leading segments
 * 
 * @param count
 */
public void removeLeadingSegments(final int count)
{
  Args.withinRange(0, segments.size(), count, "count");
  for (int i = 0; i < count; i++)
  {
    segments.remove(0);
  }
}

代码示例来源:origin: de.alpharogroup/wicket-js-addons-core

/**
 * Checks the given value if it is between 0 to 100 quietly. If not a default value from 50 will
 * be set.
 *
 * @param name
 *            the name
 * @param value
 *            the value
 * @return the integer
 */
private static Integer checkQuietly(final String name, final Integer value)
{
  Integer val = 50;
  try
  {
    val = Args.withinRange(0, 100, value, name);
  }
  catch (final IllegalArgumentException e)
  {
    LOGGER.error(String.format(
      "Given argument '%s' must have a value within [%s,%s], but was %s. Default value 50% will be set.",
      name, 0, 100, value));
  }
  return val;
}

代码示例来源:origin: apache/wicket

Args.withinRange(0, fragment.size() - 1, streamOffset, "streamOffset");

代码示例来源:origin: org.apache.wicket/wicket-core

Args.withinRange(0, fragment.size() - 1, streamOffset, "streamOffset");

相关文章

微信公众号

最新文章

更多