3.3. Title & Icon

Naked Objects uses the title() method to render a label for domain objects. For the Claim class, this is defined as:

class Claim extends AbstractDomainObject {

  ...

  String title() { status + " - " + date }

  ...
}

It's important that this is defined as returning a java.lang.String; a simple Groovy def is not sufficient.

In addition, you may want to define an iconName(). If present, this is used to locate the icon for the entity (meaning that different instances of the same type can render different icons). Otherwise, Naked Objects infers the icon from the class name. The icon is typically picked up from an images package (in src/main/resources).