_Periodical(long seconds, boolean startImmediately) { E.illegalArgumentIf(seconds < 1, "delay duration cannot be zero or negative"); this.seconds = seconds; this.startImmediately = startImmediately; }
public static InterceptorType of(Class<? extends Annotation> clz) { InterceptorType type = map.get(clz); E.illegalArgumentIf(null == type, "Not an interceptor annotation: %s", clz); return type; } }
public final String concat(String[] path) { int len = path.length; E.illegalArgumentIf(len < 1); if (len == 1) { return path[0]; } return _concat(path, len); }
public NamedPort(String name, int port) { E.NPE(name); E.illegalArgumentIf(port < 0); this.name = name; this.port = port; }
protected T cliPort(int port) { E.illegalArgumentIf(port < 1, "port value not valid: %s", port); this.cliPort = port; return me(); }
protected T maxCliSession(int size) { E.illegalArgumentIf(size < 1, "max cli session number cannot be zero or negative number: %s", size); this.maxCliSession = size; return me(); }
protected T host(String hostname) { hostname = hostname.trim(); E.illegalArgumentIf(hostname.length() == 0, "hostname cannot be empty"); host = hostname; return me(); }
protected T loginUrl(String url) { E.illegalArgumentIf(!url.startsWith("/"), "login URL shall start with '/'"); this.loginUrl = url; return me(); }
protected T flashCookieName(String name) { name = name.trim().toLowerCase(); E.illegalArgumentIf(name.length() == 0, "flash cookie name cannot be blank"); E.illegalArgumentIf(S.eq(name, sessionCookieName), "flash cookie name cannot be the same with session cookie name"); flashCookieName = name; return me(); }
private Class<T> exploreTypeInfo() { List<Type> types = Generics.typeParamImplementations(getClass(), ActProvider.class); int sz = types.size(); E.illegalStateIf(1 != sz, "generic type number not match"); Type type = types.get(0); E.illegalArgumentIf(!(type instanceof Class), "generic type is not a class: %s", type); return (Class) type; }
public CliContext chDir(File dir) { E.illegalArgumentIf(!dir.isDirectory()); session().attribute(ATTR_PWD, dir); return this; }
private String inferFullPath(String actionPath) { E.illegalArgumentIf(S.empty(actionPath), "action path expected"); if (actionPath.contains("/") || (!actionPath.contains(".") && !actionPath.contains("("))) { // this is a URL path, not action path return actionPath; } if (actionPath.contains("(")) { actionPath = org.osgl.util.S.beforeFirst(actionPath, "("); } return Router.inferFullActionPath(actionPath, INFER_REFERENCE_PROVIDER); }
@Override public void init(Object param) { time = $.convert(param).toLong(); E.illegalArgumentIf(time < 1); }
protected T localeCookieName(String name) { E.illegalArgumentIf(S.blank(name), "locale Cookie name must not be empty"); localeCookieName = name; return me(); }
protected T timePattern(String pattern) { E.illegalArgumentIf(S.blank(pattern), "Time format pattern cannot be empty"); this.timePattern = pattern; return me(); }
static JobTrigger of(AppConfig config, InvokeBefore anno) { String id = anno.value(); E.illegalArgumentIf(S.blank(id), "associate job ID cannot be empty"); return new _Before(id); }
public void on(DateTime instant, Runnable runnable) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("schedule runnable[%s] on %s", runnable, instant); } DateTime now = DateTime.now(); E.illegalArgumentIf(instant.isBefore(now)); Seconds seconds = Seconds.secondsBetween(now, instant); executor().schedule(wrap(runnable), seconds.getSeconds(), TimeUnit.SECONDS); }
static JobTrigger of(AppConfig config, AlongWith anno) { String id = anno.value(); E.illegalArgumentIf(S.blank(id), "associate job ID cannot be empty"); int delayInSeconds = anno.delayInSeconds(); if (delayInSeconds > 0) { return new _DelayAfter(id, delayInSeconds); } else { return new _AlongWith(id); } }
public static ErrorResult of(H.Status status, int errorCode) { E.illegalArgumentIf(!status.isClientError() && !status.isServerError()); if (Act.isDev()) { return new ActErrorResult(status, errorCode); } else { return ErrorResult.of(status, errorCode); } }
public StringValueResolverValueLoaderBase(ParamKey key, DefaultValue def, BeanSpec spec, boolean simpleKeyOnly) { E.illegalArgumentIf(simpleKeyOnly && !key.isSimple()); this.paramSpec = spec; this.param = spec.getAnnotation(Param.class); this.paramKey = key; this.defSpec = def; this.resolverManager = Act.app().resolverManager(); this.injector = Act.app().injector(); this.requireRuntimeType = !(spec.type() instanceof Class); this.stringValueResolver = this.requireRuntimeType ? null : lookupResolver(spec, spec.rawType()); this.defVal = this.requireRuntimeType ? null : null != def ? this.stringValueResolver.resolve(def.value()) : defVal(param, spec.rawType()); }