@Override public Keyword convert(String s) { return Keyword.of(s); } };
/** * 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)); }
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;
private String key(String name, BeanSpec spec) { if (S.notBlank(name)) { return name; } name = spec.name(); return Keyword.of(name).httpHeader(); } }
public static String underscore(CharSequence s) { return Keyword.of(s).underscore(); }
} 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)));
/** * Alias of {@link #dashed()} */ public String hyphenated() { return dashed(); }
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()); }
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; }
/** * 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(); }
/** * Alias of {@link #javaVariable()} */ public String lowerCamelCase() { return javaVariable(); }
private static boolean matches(Keyword keyword, Object o) { return keyword.matches(S.string(o)); } }
/** * 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)); }
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;
private static String fromTokens(List<String> tokens) { List<String> filtered = NoisyWordsFilter.filter(tokens); String joined = S.join(".", filtered); return Keyword.of(joined).httpHeader(); }