I am looking for the following function described below. The MessageFormat sun api does not meet my need, and the Spring El expression may also be.
Assuming we have an Object named:
Person person = new Person();
person.setName("fredop");
person.setAge("25");
String messageFormat="My name is {Person.name}, i'm {Person.age} years old""
System.out.println(Translate(person,messageFormat);
In the translation method, I will transfer ONLY one object.
This final line will print:
"My name is fred, i'm 25 years old"
Any idea of โโthe actual api doing this?
source
share