This is an example of how you generate something for each DomainObject (except enums). SpecialCases.xpt:
«IMPORT sculptormetamodel» «EXTENSION extensions::helper» «EXTENSION extensions::properties» «AROUND templates::Root::Root FOR Application» «targetDef.proceed()» «EXPAND myOwnMock FOREACH modules.domainObjects.reject(e|e.metaType == Enum)» «ENDAROUND» «DEFINE myOwnMock FOR DomainObject» «FILE javaFileName(getDomainPackage() + ".My" + name + "Mock") TO_GEN_SRC_TEST» package «getDomainPackage()»; public class My«name»Mock { } «ENDFILE» «ENDDEFINE» If you need to define that it should only be generated for some DomainObjects it is easy to use the hint mechanism. model.btdesign: Entity Planet { hint="genMock" String name } SpecialCases.xpt: «IMPORT sculptormetamodel» «EXTENSION extensions::helper» «EXTENSION extensions::properties» «AROUND templates::Root::Root FOR Application» «targetDef.proceed()» «EXPAND myOwnMock FOREACH modules.domainObjects.select(e|e.hasHint("genMock"))» «ENDAROUND» «DEFINE myOwnMock FOR DomainObject» «FILE javaFileName(getDomainPackage() + ".My" + name + "Mock") TO_GEN_SRC_TEST» package «getDomainPackage()»; public class My«name»Mock { } «ENDFILE» «ENDDEFINE» I hope that solves what you are looking for. /Patrik Patrik Nordwall wrote: > > Glad that you like it. Your customization need should not be any problem. > I will describe how to do later today. I'm mobile right now. /Patrik > > eagle-eye wrote: >> >> Hi, >> >> I really like the possibilities fo sculptor and I am trying it out right >> now. When I define my model and I want to use Mockito for my unit tests, >> I would like to generate the mockito builders/factories with the >> generation process. >> So my question is how can I customize the model in such a way that I can >> keep using the normal sculptor release and add the generation of another >> class for an entity in the model? >> Probably somewhere in the SpecialCases, but I cannot really figure out >> how from the documentation and I am not that familiar with XText yet. >> >> Thanks for any advice on how to do this. >> >> Regards, >> >> Mike >> > > -- View this message in context: http://old.nabble.com/Howto-add-extra-class-generation-to-model-%28factory-builder%29-tp29815728s17564p29822698.html Sent from the Fornax-Platform mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Fornax-developer mailing list Fornax-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fornax-developer