/* (non-Javadoc)
* @see org.directwebremoting.extend.Remoter#generateDtoScript(java.lang.String, java.lang.String, java.lang.String)
*/
public String generateDtoJavaScript(String jsClassName, String indent, String assignVariable) throws SecurityException
{
NamedConverter namedConv = converterManager.getNamedConverter(jsClassName);
if (namedConv != null)
{
// The desired output should follow this scheme (not wrapped by any
// "if already defined clauses" as this is not used by all module
// systems):
// (1) <indent><assignVariable> = function() {
// (2) <indent> this.myProp = <initial value>;
// (2) <indent> ...
// (2) <indent>}
// (3) <indent><assignVariable>.$dwrClassName = 'pkg.MyData';
// (4) <indent><assignVariable>.$dwrClassMembers = {};
// (5) <indent><assignVariable>.$dwrClassMembers.myProp = {};
// (6) <indent><assignVariable>.createFromMap = dwr.engine._createFromMap;
StringBuilder buf = new StringBuilder();
// Generate (1): <indent><assignVariable> = function() {
buf.append(indent + assignVariable + " = function() {\n");
// Generate (2): <indent> this.myProp = <initial value>;
Map<String, Property> properties = namedConv.getPropertyMapFromClass(namedConv.getInstanceType(), true, true);
for (Entry<String, Property> entry : properties.entrySet())
{
String name = entry.getKey();
Property property = entry.getValue();
Class<?> propType = property.getPropertyType();