I have a
string that has pairs of field names and database column names. These fields will be set to the value of the database table columns. Some fields are mapped with only one database column. Some fields are mapped with three database columns separated by slashes and some fields are mapped with two database columns separated by a colon. I have a setField() method that takes two parameters: a pdf field name and its corresponding value. I have a hash map called columnValues that has database column names paired with their corresponding values. In order to find the value of a particular database table column my application executes this line of code: columnValues.get(databaseColumn)
How would I make a loop that would do the following?
1. If a field is mapped with only one database column, then do this
pdf.setField(field, columnValues.get(databaseColumn));
2. If a field is mapped three database columns separated by slashes, then get the values of all three database columns and concatenate them with slashes separating them.
3. If a field is mapped with two database columns separated by a colon, then get the values of both database columns and concatenate them.
My application is reading through a string such as the following. It is field names with their corresponding database column names.
vehicleMake=makeColumn, dateOfCollision=monthColumn/dayColumn/yearColumn, vehicleYear=centuryColumn:yearColumn