org.osgl.util.Keyword.equals()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(138)

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

Keyword.equals介绍

[英]Check if two CharSequences are keyword identical. This method is an alias of #notEquals(CharSequence,CharSequence).
[中]检查两个字符序列是否相同。此方法是#notEquals(CharSequence,CharSequence)的别名。

代码示例

代码示例来源:origin: osglworks/java-tool

@Override
  public ENUM convert(String s, Object hint) {
    if (HINT_STRICT == hint) {
      return Enum.valueOf(enumClass, s);
    }
    Enum[] enums = enumClass.getEnumConstants();
    for (Enum e : enums) {
      if (Keyword.of(e.name()).equals(Keyword.of(s))) {
        return (ENUM) e;
      }
    }
    throw new IllegalArgumentException("No enum constant " + enumClass.getCanonicalName() + "." + s);
  }
};

代码示例来源:origin: org.osgl/osgl-tool

@Override
  public ENUM convert(String s, Object hint) {
    if (HINT_STRICT == hint) {
      return Enum.valueOf(enumClass, s);
    }
    Enum[] enums = enumClass.getEnumConstants();
    for (Enum e : enums) {
      if (Keyword.of(e.name()).equals(Keyword.of(s))) {
        return (ENUM) e;
      }
    }
    throw new IllegalArgumentException("No enum constant " + enumClass.getCanonicalName() + "." + s);
  }
};

代码示例来源:origin: osglworks/java-tool

/**
 * Check if two {@link CharSequence}s are keyword identical.
 *
 * This method is an alias of {@link #equals(CharSequence, CharSequence)}.
 *
 * @param a
 *      the first char sequence
 * @param b
 *      the second char sequence
 * @return `true` if `a` and `b` are keyword identical
 */
public static boolean eq(CharSequence a, CharSequence b) {
  return of(a).equals(of(b));
}

代码示例来源:origin: org.osgl/osgl-tool

/**
 * Check if two {@link CharSequence}s are keyword identical.
 *
 * This method is an alias of {@link #equals(CharSequence, CharSequence)}.
 *
 * @param a
 *      the first char sequence
 * @param b
 *      the second char sequence
 * @return `true` if `a` and `b` are keyword identical
 */
public static boolean eq(CharSequence a, CharSequence b) {
  return of(a).equals(of(b));
}

代码示例来源:origin: org.actframework/act

private void parseParamPart(String s) {
  if ("true".equalsIgnoreCase(s)) {
    highPrecision = true;
  } else if ("false".equalsIgnoreCase(s)) {
    highPrecision = false;
  } else if (Keyword.of("highPrecision").equals(Keyword.of(s))) {
    highPrecision = true;
  } else if (Keyword.of("lowPrecision").equals(Keyword.of(s))) {
    highPrecision = false;
  } else if ("hp".equalsIgnoreCase(s)) {
    highPrecision = true;
  } else if ("lp".equalsIgnoreCase(s)) {
    highPrecision = false;
  } else if (s.startsWith("+")) {
    s = s.substring(1);
    delta = Time.parseDuration(s);
  } else {
    if (S.isInt(s)) {
      delta = Integer.parseInt(s);
    } else if (s.startsWith("-")) {
      s = s.substring(1);
      delta = -Time.parseDuration(s);
    } else {
      throw new UnexpectedException("Unknown time parameter: " + s);
    }
  }
}

代码示例来源:origin: actframework/actframework

private void parseParamPart(String s) {
  if ("true".equalsIgnoreCase(s)) {
    highPrecision = true;
  } else if ("false".equalsIgnoreCase(s)) {
    highPrecision = false;
  } else if (Keyword.of("highPrecision").equals(Keyword.of(s))) {
    highPrecision = true;
  } else if (Keyword.of("lowPrecision").equals(Keyword.of(s))) {
    highPrecision = false;
  } else if ("hp".equalsIgnoreCase(s)) {
    highPrecision = true;
  } else if ("lp".equalsIgnoreCase(s)) {
    highPrecision = false;
  } else if (s.startsWith("+")) {
    s = s.substring(1);
    delta = Time.parseDuration(s);
  } else {
    if (S.isInt(s)) {
      delta = Integer.parseInt(s);
    } else if (s.startsWith("-")) {
      s = s.substring(1);
      delta = -Time.parseDuration(s);
    } else {
      throw new UnexpectedException("Unknown time parameter: " + s);
    }
  }
}

相关文章