Hi All,
I’m new to smartgwt, great framework.
Is there a utility class to convert Record to POJO and vice versa ?
I thought about writing one by myself but I’m unable to add the Java reflection classes.
My server side is managed by spring and my RPC send/retrieve pojos and it would be nice if I will be able to automatically convert them into Record in order to populate my ui components.
Take a look at the QuickStart Guide chapter on the Server Framework. POJOs can be returned as the result of a DataSource operation. The fields you declare in your DataSource are then automatically extracted and appear as Record objects client-side.
This also avoids the need to write “DTOs” to limit the data sent to the client, since the DataSource naturally limits output to just the fields you’re using client-side.
You can have a one-liner .ds.xml file which causes field definitions to be derived on the fly from Java POJOs, SQL tables or other sources of metadata (see the QuickStart Guide chapter on the Server Framework, at the beginning) or you can dynamically create the XML and pass it to DataSource.fromXML().