org.apache.wicket.util.string.Strings.isTrue()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(103)

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

Strings.isTrue介绍

[英]Converts the text in s to a corresponding boolean. On, yes, y, true and 1 are converted to true. Off, no, n, false and 0 (zero) are converted to false. An empty string is converted to false. Conversion is case-insensitive, and does not take internationalization into account. 'Ja', 'Oui', 'Igen', 'Nein', 'Nee', 'Non', 'Nem' are all illegal values.
[中]将s中的文本转换为相应的布尔值。On、yes、y、true和1被转换为[$1$]。Off、no、n、false和0(零)将转换为false。空字符串将转换为false。转换不区分大小写,并且不考虑国际化。”Ja、Oui、Igen、Nein、Nee、Non、Nem都是非法值。

代码示例

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

/**
 * Convert this text to a boolean.
 * 
 * @return This string value as a boolean
 * @throws StringValueConversionException
 */
public final boolean toBoolean() throws StringValueConversionException
{
  return Strings.isTrue(text);
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Convert this text to a boolean.
 * 
 * @return This string value as a boolean
 * @throws StringValueConversionException
 */
public final boolean toBoolean() throws StringValueConversionException
{
  return Strings.isTrue(text);
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Convert this text to a boolean.
 * 
 * @return This string value as a boolean
 * @throws StringValueConversionException
 */
public final boolean toBoolean() throws StringValueConversionException
{
  return Strings.isTrue(text);
}

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

/**
 * Converts the string s to a Boolean. See <code>isTrue</code> for valid values of s.
 * 
 * @param s
 *            The string to convert.
 * @return Boolean <code>TRUE</code> when <code>isTrue(s)</code>.
 * @throws StringValueConversionException
 *             when s is not a valid value
 * @see #isTrue(String)
 */
public static Boolean toBoolean(final String s) throws StringValueConversionException
{
  return isTrue(s);
}

代码示例来源:origin: theonedev/onedev

/**
 * Converts the string s to a Boolean. See <code>isTrue</code> for valid values of s.
 * 
 * @param s
 *            The string to convert.
 * @return Boolean <code>TRUE</code> when <code>isTrue(s)</code>.
 * @throws StringValueConversionException
 *             when s is not a valid value
 * @see #isTrue(String)
 */
public static Boolean toBoolean(final String s) throws StringValueConversionException
{
  return isTrue(s);
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Converts the string s to a Boolean. See <code>isTrue</code> for valid values of s.
 * 
 * @param s
 *            The string to convert.
 * @return Boolean <code>TRUE</code> when <code>isTrue(s)</code>.
 * @throws StringValueConversionException
 *             when s is not a valid value
 * @see #isTrue(String)
 */
public static Boolean toBoolean(final String s) throws StringValueConversionException
{
  return Boolean.valueOf(isTrue(s));
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Converts the string s to a Boolean. See <code>isTrue</code> for valid values of s.
 * 
 * @param s
 *            The string to convert.
 * @return Boolean <code>TRUE</code> when <code>isTrue(s)</code>.
 * @throws StringValueConversionException
 *             when s is not a valid value
 * @see #isTrue(String)
 */
public static Boolean toBoolean(final String s) throws StringValueConversionException
{
  return Boolean.valueOf(isTrue(s));
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * This will return true if the header "Wicket-Ajax" is set.
 * 
 * @see org.apache.wicket.protocol.http.WebRequest#isAjax()
 */
// TODO matej? should we have a simple way of supporting other ajax things?
// or should they just set that same header??
public boolean isAjax()
{
  boolean ajax = false;
  String ajaxHeader = httpServletRequest.getHeader("Wicket-Ajax");
  if (Strings.isEmpty(ajaxHeader) == false)
  {
    try
    {
      ajax = Strings.isTrue(ajaxHeader);
    }
    catch (StringValueConversionException e)
    {
      // We are not interested in this exception but we log it anyway
      log.debug("Couldn't convert the Wicket-Ajax header: " + ajaxHeader);
    }
  }
  return ajax;
}

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

/**
 * Returns whether this request is an Ajax request. This implementation checks for values of
 * {@value #PARAM_AJAX} url parameter or the {@value #HEADER_AJAX} header. Subclasses can use
 * other approaches.
 * 
 * @return <code>true</code> if this request is an ajax request, <code>false</code> otherwise.
 */
public boolean isAjax()
{
  try {
    return Strings.isTrue(getHeader(HEADER_AJAX)) ||
      Strings.isTrue(getQueryParameters().getParameterValue(PARAM_AJAX).toString());
  } catch (StringValueConversionException invalidValue) {
    return false;
  }
}

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

/**
 * Returns whether this request is an Ajax request. This implementation checks for values of
 * {@value #PARAM_AJAX} url parameter or the {@value #HEADER_AJAX} header. Subclasses can use
 * other approaches.
 * 
 * @return <code>true</code> if this request is an ajax request, <code>false</code> otherwise.
 */
public boolean isAjax()
{
  try {
    return Strings.isTrue(getHeader(HEADER_AJAX)) ||
      Strings.isTrue(getQueryParameters().getParameterValue(PARAM_AJAX).toString());
  } catch (StringValueConversionException invalidValue) {
    return false;
  }
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

ajax = Strings.isTrue(ajaxHeader);

代码示例来源:origin: brix-cms/brix-cms

@Override
public void respond(IRequestCycle requestCycle) {
  boolean save = (this.save != null) ? this.save : Strings.isTrue(RequestCycle.get().getRequest().getRequestParameters()
      .getParameterValue(SAVE_PARAMETER).toString());

代码示例来源:origin: de.alpharogroup/wicket-bootstrap3

@Override
protected void onGlobalSettings()
{
  super.onGlobalSettings();
  getApplicationSettings().setUploadProgressUpdatesEnabled(true);
  // deactivate ajax debug mode
  // getDebugSettings().setAjaxDebugModeEnabled(false);
  configureBootstrap();
  // configureResourceBundles();
  optimizeForWebPerformance();
  new AnnotatedMountScanner().scanPackage(getPackageToScan()).mount(this);
  if (Strings.isTrue(getProperties().getProperty("cdn.useCdn")))
  {
    final String cdn = getProperties().getProperty("cdn.baseUrl");
    StaticResourceRewriteMapper.withBaseUrl(cdn).install(this);
  }
  final IPackageResourceGuard packageResourceGuard = getResourceSettings()
    .getPackageResourceGuard();
  if (packageResourceGuard instanceof SecurePackageResourceGuard)
  {
    final SecurePackageResourceGuard securePackageResourceGuard = (SecurePackageResourceGuard)packageResourceGuard;
    securePackageResourceGuard.addPattern("+*.woff2");
  }
}

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

try
  autolinking = Strings.isEmpty(autolink) || Strings.isTrue(autolink);

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

try
  autolinking = Strings.isEmpty(autolink) || Strings.isTrue(autolink);

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

if (Strings.isTrue(value))

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

try
  autolinking = Strings.isEmpty(autolink) || Strings.isTrue(autolink);

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

try
  autolinking = Strings.isEmpty(autolink) || Strings.isTrue(autolink);

相关文章