You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2012/09/05 20:15:20 UTC

Yet another new annotation...

fyi, a feature I've implemented in the Wicket viewer (about to commit) is
support for @CommonlyUsed.


/**
 * Indicates that a class member is commonly used and so should
 * be presented in the viewer in an appropriate manner.
 *
 * <p>
 * For example, an <tt>Order#lineItems</tt> collection might be
 * &quot;opened&quot; automatically so that the user could see a list of
 * line items immediately when the order is rendered.
 *
 * <p>
 * Or, a property containing an <tt>Address</tt> might show the referenced
 * address as an embeddded property.
 *
 * <p>
 * Or, an action <tt>Submit</tt> might be rendered as a button rather than
 * buried inside a submenu somewhere.
 *
 * <p>
 * For properties and collections there is some similarity between this
concept
 * and that of eager-loading as supported by some object stores.  Indeed,
some
 * object stores may choose use their own specific annotations (eg a JDO
default
 * fetch group) in order to infer this semantic.
 */
@Inherited
@Target( ElementType.METHOD )
@Retention(RetentionPolicy.RUNTIME)
public @interface CommonlyUsed {


For example:

public class Order {
    @CommonlyUsed
    public List<LineItem> getDetails() { ... }
    ...

}

If anyone hates the name, please suggest an alternative!  (I was going to
call it @Eager or @Eagerly, but I decided that

Dan