Reputation: 15
I am formatting my messages in a properties 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!
Upvotes: 0
Views: 107
Reputation: 1501103
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.
Upvotes: 2