All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jn.langx.text.ParameterizedMessage Maven / Gradle / Ivy

Go to download

Java lang extensions for java6+, a supplement to , replacement of a Guava, commons-lang. Core utilities, Collection utilities, IO utilities, Cache, Configuration library ...

There is a newer version: 4.8.2
Show newest version
package com.jn.langx.text;

/**
 * 参数化消息
 * 
* 使用方式:
* * new ParameterizedMessage("hello {0}, welcome you to {1} . ", new Object[]{"zhang san", "BeiJing"}); *
那么结果就是: * "hello zhang san, welcome you to BeiJing ." * * @author fangjinuo */ public class ParameterizedMessage { private volatile String template; private Object[] args = null; public ParameterizedMessage() { } public ParameterizedMessage(String template) { this.template = template; } public ParameterizedMessage(String template, Object... args) { this.template = template; this.args = args; } public String getMessage() { if (template != null) { return StringTemplates.format(template, args); } return ""; } @Override public String toString() { return getMessage(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy