Java Code Examples for org.osgl.util.S#fmt()
The following examples show how to use
org.osgl.util.S#fmt() .
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: ActError.java From actframework with Apache License 2.0 | 6 votes |
public static String errorMessage(H.Status status, String message, Object ... args) { if (S.notBlank(message)) { return S.fmt(message, args); } if (Act.isProd()) { return MvcConfig.errorMessage(status); } ActionContext ctx = ActionContext.current(); if (null == ctx) { return MvcConfig.errorMessage(status); } RequestHandler handler = ctx.handler(); if (null == handler) { return MvcConfig.errorMessage(status); } if (H.Status.NOT_FOUND == status) { return I18n.i18n(Act.class, "e404.null_value_returned", handler); } return I18n.i18n(Act.class, "error.on_invoking", MvcConfig.errorMessage(status), handler); }
Example 2
Source File: CliHandlerProxy.java From actframework with Apache License 2.0 | 6 votes |
@Override public void handle(CliContext context) { try { ensureAgentsReady(); saveCommandPath(context); Object result = _handle(context); onResult(result, context); } catch ($.Break b) { throw b; } catch (CliException error) { context.println(error.getMessage()); } catch (Exception e) { String msg = e.getMessage(); if (S.blank(msg)) { msg = S.fmt("Error processing command: %s", e); } context.println(msg); logger.error(e, "Error handling request"); } catch (Throwable t) { logger.fatal(t, "Error handling request"); } finally { PropertySpec.current.remove(); } }
Example 3
Source File: ErrorTemplatePathResolver.java From actframework with Apache License 2.0 | 5 votes |
@Override public String resolve(int code, H.Format fmt) { String suffix; if (JSON == fmt || HTML == fmt || XML == fmt) { suffix = fmt.name(); } else { suffix = TXT.name(); } return Act.isProd() || "json".equals(suffix) ? S.fmt("/error/e%s.%s", code, suffix) : S.fmt("/error/dev/e%s.%s", code, suffix); }
Example 4
Source File: MetricInfoTree.java From actframework with Apache License 2.0 | 4 votes |
@Override public String transform(MetricInfo metricInfo) { return S.fmt("%s: %s / %s = %s", metricInfo.getName(), metricInfo.getAccumulated(), metricInfo.getCountAsStr(), metricInfo.getAvg()); }
Example 5
Source File: SingletonEnhancer.java From actframework with Apache License 2.0 | 4 votes |
private String instanceTypeDesc() { return S.fmt("L%s;", typeName); }
Example 6
Source File: DuplicateRouteMappingException.java From actframework with Apache License 2.0 | 4 votes |
@Override public String getErrorDescription() { return S.fmt("Can not overwrite existing route mapping:\n\t%s\nwith new route mapping:\n\t%s", existingRouteMapping, newRouteMapping); }
Example 7
Source File: RouteMappingException.java From actframework with Apache License 2.0 | 4 votes |
@Override public String getErrorDescription() { return S.fmt("Error setting route mapping: %s", cause); }
Example 8
Source File: FastRuntimeException.java From java-tool with Apache License 2.0 | 4 votes |
public FastRuntimeException(Throwable cause, String message, Object... args) { super(S.fmt(message, args), cause); }
Example 9
Source File: ToBeImplemented.java From java-tool with Apache License 2.0 | 4 votes |
public ToBeImplemented(String message, Object... args){ super(S.fmt(message, args)); }
Example 10
Source File: JsonDtoClassGenerator.java From actframework with Apache License 2.0 | 4 votes |
private String setterSignature(BeanSpec spec) { return S.fmt("(%s)V", typeDesc(spec)); }
Example 11
Source File: ScopedObjects.java From java-di with Apache License 2.0 | 4 votes |
@Override public String toString() { return S.fmt("%s[%s]", getClass().getSimpleName(), id); }
Example 12
Source File: InvalidArgException.java From java-tool with Apache License 2.0 | 4 votes |
public InvalidArgException(String message, Object... args){ super(S.fmt(message, args)); }
Example 13
Source File: PortOccupiedException.java From actframework with Apache License 2.0 | 4 votes |
@Override public String getMessage() { return S.fmt("port %s is occupied", port); }
Example 14
Source File: NamedPort.java From actframework with Apache License 2.0 | 4 votes |
@Override public String toString() { return S.fmt("%s[:%s]", name, port); }
Example 15
Source File: JsonDtoClassGenerator.java From actframework with Apache License 2.0 | 4 votes |
private static String setterDescriptor(BeanSpec spec) { return S.fmt("(%s)V", classDesc(spec.rawType())); }
Example 16
Source File: ToBeImplemented.java From java-tool with Apache License 2.0 | 4 votes |
public ToBeImplemented(Throwable cause, String message, Object... args) { super(S.fmt(message, args), cause); }
Example 17
Source File: ParamAnnoInfoTraitBase.java From actframework with Apache License 2.0 | 4 votes |
@Override public String compatibilityErrorMessage(ParamAnnoInfoTrait otherParamAnnotation) { return S.fmt("Param annotations cannot co-exists: %s vs %s", getClass(), otherParamAnnotation.getClass()); }
Example 18
Source File: SenderEnhancer.java From actframework with Apache License 2.0 | 4 votes |
@Override public String toString() { return S.fmt("%sLoad %s", insn, index); }
Example 19
Source File: VarDef.java From actframework with Apache License 2.0 | 4 votes |
@Override public String toString() { return S.fmt("%s|%s", name, type); }
Example 20
Source File: EventBus.java From actframework with Apache License 2.0 | 3 votes |
/** * Override parent implementation so that if this * event bus is a one time event bus, it will prepend * `[once]` into the message been logged * * @param msg * the message * @param args * the message arguments */ @Override protected void trace(String msg, Object... args) { msg = S.fmt(msg, args); if (once) { msg = S.builder("[once]").append(msg).toString(); } super.trace(msg); }