org.osgl.util.Keyword类的使用及代码示例

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

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

Keyword介绍

[英]A Keyword can be presented in the different ways: * CamelCaseStyle * underscore_style * CONSTANT_STYLE * dash-style * "readable style" * "Http-Header-Style" When reading a string into a keyword, the following separator chars will be ignored and used as separator to construct the keyword * space ' ' * underscore: _ * dash: - * comma: , * dot: . * colon: : * semi-colon: ; * slash: \ * forward slash: /
[中]“关键字”可以用不同的方式表示:CamelCaseStyle下划线\u样式常量\u样式破折号样式*“可读样式”“Http头样式”在将字符串读入关键字时,将忽略以下分隔符字符,并将其用作分隔符来构造关键字空格“''''.''.''.''.'.''.'''.'破折号:'-'.*逗号:*点:.*冒号::*分号:*斜杠:\*正斜杠:/

代码示例

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

@Override
  public Keyword convert(String s) {
    return Keyword.of(s);
  }
};

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

public static String dashed(CharSequence s) {
  return Keyword.of(s).dashed();
}

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

public static String canonical(String key) {
  return Keyword.of(key).dotted();
}

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

public boolean matches(CharSequence charSequence) {
  return matches(Keyword.of(charSequence));
}

代码示例来源: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: actframework/actframework

Keyword keyword = null;
if (S.is(name).wrappedWith(TILDE)) {
  keyword = Keyword.of(S.strip(name).of(TILDE));
  Node node = keywordMatchingChildren.get(keyword);
  if (null == node) {
    keywordMatchingChildren.put(keyword, node);
    hasKeywordMatchingChild = true;
    staticChildren.put(keyword.javaVariable(), node);
    staticChildren.put(keyword.hyphenated(), node);
    staticChildren.put(keyword.underscore(), node);
    return node;

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

private String key(String name, BeanSpec spec) {
    if (S.notBlank(name)) {
      return name;
    }
    name = spec.name();
    return Keyword.of(name).httpHeader();
  }
}

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

public static String underscore(CharSequence s) {
  return Keyword.of(s).underscore();
}

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

} else {
  if (findOne) {
    Object found = dao.findOneBy(Keyword.of(queryFieldName).javaVariable(), by);
    if (null == found) {
      col.addAll(dao.findAllAsList());
    } else {
      col.addAll(C.list(dao.findBy(Keyword.of(queryFieldName).javaVariable(), by)));

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

private static List<String> classNameTokensReversed(Class theClass) {
  return C.list(Keyword.of(theClass.getSimpleName()).tokens()).reverse();
}

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

/**
 * Alias of {@link #dashed()}
 */
public String hyphenated() {
  return dashed();
}

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

void register(Keyword keyword, NamedLogic logic, boolean force) {
  Class<? extends NamedLogic> type = logic.type();
  Map<Keyword, NamedLogic> lookup = registry.get(type);
  if (null == lookup) {
    lookup = new HashMap<>();
    registry.put(type, lookup);
  }
  NamedLogic existing = lookup.put(keyword, logic);
  E.unexpectedIf(!force && null != existing && logic != existing, "Keyword already used: " + keyword.hyphenated());
}

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

private static String resolve(Keyword keyword, ActContext ctx) {
  String value = ctx.paramVal(keyword.underscore());
  if (S.notBlank(value)) {
    return value;
  }
  value = ctx.paramVal(keyword.javaVariable());
  if (S.notBlank(value)) {
    return value;
  }
  return null;
}

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

/**
 * Returns string representation of this keyword using
 * {@link Style#UNDERSCORE underscore style}
 * @return the underscore style representation of this keyword
 */
@Override
public String toString() {
  return underscore();
}

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

/**
 * Alias of {@link #javaVariable()}
 */
public String lowerCamelCase() {
  return javaVariable();
}

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

private static boolean matches(Keyword keyword, Object o) {
    return keyword.matches(S.string(o));
  }
}

代码示例来源: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.actframework/act

Keyword keyword = null;
if (S.is(name).wrappedWith(TILDE)) {
  keyword = Keyword.of(S.strip(name).of(TILDE));
  Node node = keywordMatchingChildren.get(keyword);
  if (null == node) {
    keywordMatchingChildren.put(keyword, node);
    hasKeywordMatchingChild = true;
    staticChildren.put(keyword.javaVariable(), node);
    staticChildren.put(keyword.hyphenated(), node);
    staticChildren.put(keyword.underscore(), node);
    return node;

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

private static String fromTokens(List<String> tokens) {
  List<String> filtered = NoisyWordsFilter.filter(tokens);
  String joined = S.join(".", filtered);
  return Keyword.of(joined).httpHeader();
}

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

public boolean matches(CharSequence charSequence) {
  return matches(Keyword.of(charSequence));
}

相关文章