Java Code Examples for org.osgl.util.S#isBlank()
The following examples show how to use
org.osgl.util.S#isBlank() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CliArgumentLoader.java From actframework with Apache License 2.0 | 6 votes |
@Override public Object load(Object cached, ActContext<?> context, boolean noDefaultValue) { CliContext ctx = (CliContext) context; CliContext.ParsingContext ptx = ctx.parsingContext(); int id = ptx.curArgId().getAndIncrement(); String optVal = ctx.commandLine().argument(id); Object val = null; if (S.isBlank(optVal)) { optVal = ptx.argDefVals.get(id); } if (S.notBlank(optVal)) { val = resolver.resolve(optVal); } if (null == val && null != cached) { val = cached; } return val; }
Example 2
Source File: ConfigurationValueLoader.java From java-di with Apache License 2.0 | 5 votes |
@Override public T get() { String confKey = value(); if (S.isBlank(confKey)) { throw new InjectException(("Missing configuration key")); } Object conf = conf(confKey, defaultValue); if (null == conf) { return null; } return cast(conf, spec); }
Example 3
Source File: EmailHandler.java From actframework with Apache License 2.0 | 5 votes |
private boolean isValid(Object val) { String s = S.string(val); boolean valid = (S.isBlank(s) || s.toLowerCase().matches("^[_a-z0-9-']+(\\.[_a-z0-9-']+)*(\\+[0-9]+)?@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,64})$")); if (!valid) { return false; } // check tld String tld = S.cut(s).afterLast("."); return tldList.isTld(tld); }
Example 4
Source File: FileBinder.java From actframework with Apache License 2.0 | 5 votes |
@Override public File resolve(File file, String s, ParamValueProvider paramValueProvider) { ActionContext ctx = $.cast(paramValueProvider); if (ctx.req().url().startsWith("/~/cmd/run")) { String fileName = ctx.paramVal(s); if (S.isBlank(fileName)) { return null; } return new File(fileName); } ISObject sobj = ctx.upload(s); return null == sobj ? null : sobj.asFile(); }
Example 5
Source File: CaptchaSession.java From actframework with Apache License 2.0 | 5 votes |
private String ensureMediaUrl(String url, String text) { if (S.isBlank(url)) { String encrypted = Act.crypto().encrypt(text); return "/~/captcha/" + encrypted; } return url; }