I think it should be
if (java.util.Date.class.getName().equals(type)) return "new
java.util.Date()";
A more general solution might be
Class c = Class.forName( type );
return c.newInstance();
surrounded with a suitable try/catch block, and the type must have a
default constructor.
On Mon, 2004-08-02 at 12:53, Carlos Cuenca wrote:
> Hi,
>
> I am testing the BPM4Struts cartridge and I have some parameters on a
> <<FrontEndEvent>> of type Date, I get and error during compiling:
>
> E:\pruebasAndroMDA\web\src\java\server\web\productos\CAltaProducto.java:228:
> setFSolicitud(java.util.Date) in server.web.productos.AltaProd
> uctoGeneralForm cannot be applied to (java.lang.String)
> form.setFSolicitud("fSolicitud-test");
>
> I had been looking the AndroMDA BPM4Struts code, and I had found in the
> StrutsParameterLogicImpl.java a method to fill with values the fields:
> public String handleGetResetValue()
> {
> final String name = getName();
> final String type = getType().getFullyQualifiedName();
> if (String.class.getName().equals(type)) return "\"" + name +
> "-test" + "\"";
>
> if ("boolean".equals(type)) return "false";
> if ("float".equals(type)) return "(float)" + name.hashCode() /
> hashCode();
> if ("double".equals(type)) return "(double)" + name.hashCode() /
> hashCode();
> if ("short".equals(type)) return "(short)" + name.hashCode();
> if ("long".equals(type)) return "(long)" + name.hashCode();
> if ("byte".equals(type)) return "(byte)" + name.hashCode();
> if ("char".equals(type)) return "(char)" + name.hashCode();
> if ("int".equals(type)) return "(int)" + name.hashCode();
>
> final String array = constructArray();
> if (getType().isArrayType()) return array;
> if (getType().isCollectionType()) return
> "java.util.Arrays.asList(" + array + ")";
>
> return "\"" + name + "-test" + "\"";
> }
> I think it also should be included a line for Dates:
> if (String.class.getName().equals(type)) return "new Date()";
>
> it this correct?
>
> thank you!
>
> Carlos
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by OSTG. Have you noticed the changes on
> Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
> one more big change to announce. We are now OSTG- Open Source Technology
> Group. Come see the changes on the new OSTG site. www.ostg.com
> _______________________________________________
> Andromda-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/andromda-user
--
Martin West
Head of Product Design and Development
http://www.star-map.net
+44(0)207 318 0308
+44(0)787 968 0096
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Andromda-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-user