I want to use Java to bind to the SOAP API to insert some objects into salesforce from a CSV file. I don't want to use the dataloader or excel connector, because I will be inserting multiple related objects and will be writing code to automate the whole process with a single button press.
My CSV files have the first line defining the names of the fields that I want to insert. I want to keep my solution as flexible as possible, so I don't want to hardcode the order of the fields like the following:
Account acc = new Account();
acc.setId(id);
acc.setName(name);
...
Instead, I would like to read the first line and perhaps insert the order/name combination into a map and then use this to somehow call the right setter methods for my object (This obviously presumes that the header names are well formed).
I am stuck on how I can call a setter method, or even set a field using the dot notation, in the above scenario using the name of the field. Is there a way to achieve this?
Thanks