I am formatting my messages in a properti开发者_运维技巧es file, but in order to display the desired message fragments I need to validate the arguments... By validate I mean NOT NULL..
ex. LOCATION_NOT_FOUND=Unable to find State: {0} {display only if {1} not null, city:{1}}.
desired output would be- "Unable to find State:New Jersey" if city is not null - "Unable to find State:New Jersey, city:Trenton"
i was thinking about using {1,choice, notnull#city{1}}, but I have no clue if this is correct...
Thanks Guys!
I would have two different messages:
LOCATION_NOT_FOUND_STATE=...
LOCATION_NOT_FOUND_STATE_AND_CITY=...
then format the appropriate one based on what non-null values you have.
精彩评论