Get the book!

IntelliJ IDEA Support

Posted by Eitan Suez Thu, 13 Jul 2006 20:54:00 GMT

Sam Griffith proposed on the jMatter mailing list (a couple of weeks ago) the construction of a jMatter application for the construction of jMatter applications.

I can imagine how one might simply instantiate a few instances of "Entity" in a GUI, specify field names, and other meta-information, and then layer behaviour on top of it, namely: "Generate Source Code."

This is a worthy goal. In fact, I clearly recall once seeing screenshots of an application built by Rick Mugridge for NakedObjects called "Emperor" (although as far as I know, this application was never made accessible to a wider audience).

We will get there. But in the meantime, I thought I'd post a few simple IntelliJ IDEA live templates for jMatter that I recently put together. This is nothing fancy, but it's a small, first step.

The xml file, jmatter.xml, can be dropped into the config/templates/ directory of your user configuration area. On linux, the full path is ~/.IntelliJIdea50/config/templates/

So, for example, if you've defined a class named Talk and a many to one association to a Speaker via a field named spk, instead of hand-coding the JavaBeans bound property's getter and setter methods, you can instead type:

    bprop[tab]

and fill in the two arguments: spk[tab] and Speaker[tab] and you're basically done.

I've defined a little over a dozen such simple live timeplates (fo for fieldOrder, cc for ColorCode, cmd for defining a command method, etc..

2 comments

Comments

  1. Java Developer said about 18 hours later:

    What is the purpose of cri (create instance) code pattern? When should it be used?

    cheers

  2. eitan said 19 days later:

    createInstance() creates and initializes a new domain object programmatically. It's equivalent to the New command on types.

    it not only instantiates the object in question but sets its initial state properly and performs initialization (if applicable).

    progammatically, in jmatter you should use createInstance() and not simply invoke a constructor.

Comments are disabled

Powered