Skip to content

Ignoring Properties

Geoffrey Wiseman edited this page May 21, 2014 · 2 revisions

If you're doing a translation and you don't want to include a field or method that Moo might otherwise included, you can configure Moo to ignore that field or method with the @Ignore annotation, added in Moo v1.3.

If you feel so inclined, you can add some explanation of why you're ignoring it on the annotation.

For instance, if you have some convenience methods with some delegation on them, you might not want Moo to invoke these:

@Access(AccessMode.METHOD)
public class Employee {
  private String name;
  private Address homeAddress;

  public void setName( String name ) {
    this.name = name;
  }

  public void setHomeAddress( Address address ) {
    this.homeAddress = address;
  }

  @Ignore( "This just delegates to homeAddress anyway." )
  public void setHomeStreet( String street ) {
    this.homeAddress.setStreet( street );
  }
}

If, however, you want the property to be translated if a source is available, you might want to also look at Optional and Required Properties.