I have adapted the code and now the type to be used is the type defined for the Bean property (String, Double, ....)
I plan to finalize a first version of my code next week. Question : 1) Is Camel project interested to 'host' this code ? 2) If the answer is yes, can you provide guidelines about packaging, where this code must be submitted in svn, How it will be integrated with Camel, .... ? Regards, Charles cmoulliard wrote: > > - Concerning the formatType, this parameter could be optional. If not > provided, the type of the field will be used to format the data. > > - For the position, this could be possible but only for the case where we > would like to map the content of a CSV record to one class and not to > several classes. The advantage to define the position in the annotations > of the class is that we can use them to generate the Model documentation > between CSV file & classes ;-) > > > James.Strachan wrote: >> >> 2009/1/6 cmoulliard <cmoulli...@gmail.com>: >>> >>> What do you mean ? >> >> That you don't have to specify the position / formatType parameters on >> the annotation - and your reflection/introspection code could figure >> those out from the types of the fields/properties and their position >> in the class definition >> >>> >>> >>> James.Strachan wrote: >>>> >>>> 2009/1/6 cmoulliard <cmoulli...@gmail.com>: >>>>> >>>>> "In your case, I'd add the hooks to scan packages/classes for >>>>> annotations to your custom DataFormat? Rather like with JAXB or >>>>> XStream you can configure a list of classes/packages, you'd be doing >>>>> something similar right?" >>>>> >>>>> This is exactly what I have done. The name of the package is provided >>>>> as >>>>> parameter to the DataFormat class. Next, using >>>>> reflection/introspection >>>>> the >>>>> classes of the model are retrieved. I have implemented something >>>>> simple >>>>> but >>>>> we can bind one or several classes to a CSV record. >>>>> >>>>> ex : >>>>> >>>>> public class Client { >>>>> >>>>> @DataField(name = "ClientNumber", pos = 1, formatType = >>>>> "java.lang.String") >>>>> public String clientNr; >>>>> >>>>> @DataField(name = "firstName", pos = 2, formatType = >>>>> "java.lang.String") >>>>> public String FirstName; >>>>> >>>>> @DataField(name = "lastName", pos = 3, formatType = >>>>> "java.lang.String") >>>>> public String LastName; >>>>> >>>>> @Record(separator =",", name = "Order") >>>>> public class Order { >>>>> >>>>> @DataField(name = "Number", pos = 0, formatType = >>>>> "java.lang.Integer") >>>>> public int orderNr; >>>>> >>>>> @LinkField( from = "com.xpectis.csv.model.Order", to = >>>>> "com.xpectis.csv.model.Client", linkType = LinkType.OneToOne) >>>>> public Client client; >>>>> >>>>> @DataField(name = "ISIN", pos = 4, formatType = >>>>> "java.lang.String") >>>>> public String ISIN_Code; >>>>> >>>>> @DataField(name = "Name", pos = 5, formatType = >>>>> "java.lang.String") >>>>> public String Instrument_Name; >>>>> >>>>> @DataField(name = "Quantity", pos = 6, formatType = >>>>> "java.lang.String") >>>>> public String Quantity; >>>>> >>>>> @DataField(name = "Cur", pos = 7, formatType = >>>>> "java.lang.String") >>>>> public String Currency; >>>>> >>>>> Remark : It is also possible to link class together (but only One to >>>>> One >>>>> relation is supported) using the annotation @LinkField and makes sense >>>>> because I don't want to support nested CSV. >>>> >>>> Great stuff! >>>> >>>> BTW could the pos & formatType be inferred from the >>>> reflection/introspection? >>>> >>>> -- >>>> James >>>> ------- >>>> http://macstrac.blogspot.com/ >>>> >>>> Open Source Integration >>>> http://fusesource.com/ >>>> >>>> >>> >>> >>> ----- >>> Charles Moulliard >>> SOA Architect >>> >>> My Blog : http://cmoulliard.blogspot.com/ >>> http://cmoulliard.blogspot.com/ >>> -- >>> View this message in context: >>> http://www.nabble.com/Advise-on-%40Annotation---Reflection-%21%21-tp21141422s22882p21311190.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> James >> ------- >> http://macstrac.blogspot.com/ >> >> Open Source Integration >> http://fusesource.com/ >> >> > > ----- Charles Moulliard SOA Architect My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ -- View this message in context: http://www.nabble.com/Advise-on-%40Annotation---Reflection-%21%21-tp21141422s22882p21334374.html Sent from the Camel - Users mailing list archive at Nabble.com.