Is there a better way to do this
Is there a better way to do this
- Subject: Is there a better way to do this
- From: Tom Jones <email@hidden>
- Date: Thu, 9 Sep 2004 17:20:57 -0500
I have a WOComponent whose purpose is to edit lists of objects that
all descend from the class Enumeration. Following the design pattern
in the Authors example, when I add an Enumeration, I add it to an
NSArray, and insert it into the editing context. then I create a new
instance of the object. Anyway, this code works, but it seems like
there would be an easier way to accomplish this.
Constructor c;
EOEditingContext ec = session.defaultEditingContext();
boolean enumerationAdded = false;
if (!(enumerationList.containsObject(enumeration)))
{
enumerationList.addObject(enumeration);
ec.insertObject(enumeration);
ec.saveChanges();
try
{
c = enumeration.getClass().getConstructor(new Class[]{});
enumeration = (Enumerations)c.newInstance(new Object[]{});
}
catch (Exception ex)
{
//TO DO
}
}
return null;
}
Thanks, Tom
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.