diff options
Diffstat (limited to 'src/lombok/ToString.java')
-rw-r--r-- | src/lombok/ToString.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lombok/ToString.java b/src/lombok/ToString.java index 10c61807..46d9dabe 100644 --- a/src/lombok/ToString.java +++ b/src/lombok/ToString.java @@ -33,8 +33,9 @@ import java.lang.annotation.Target; * that it's doing nothing at all. The parameter list and return type are not relevant when deciding to skip generation of * the method; any method named <code>toString</code> will make <code>@ToString</code> not generate anything. * <p> - * All fields that are non-static are used in the toString generation. You can exclude fields by specifying them - * in the <code>exclude</code> parameter. + * By default, all fields that are non-static are used in the toString generation. You can exclude fields by specifying them + * in the <code>exclude</code> parameter. You can also explicitly specify the fields that + * are to be used by specifying them in the <code>of</code> parameter. * <p> * Array fields are handled by way of {@link java.util.Arrays#deepToString(Object[])} where necessary. * The downside is that arrays with circular references (arrays that contain themselves, @@ -60,10 +61,19 @@ public @interface ToString { /** * Any fields listed here will not be printed in the generated <code>toString</code> implementation. + * Mutually exclusive with {@link #of()}. */ String[] exclude() default {}; /** + * If present, explicitly lists the fields that are to be printed. + * Normally, all non-static fields are printed. + * <p> + * Mutually exclusive with {@link #exclude()}. + */ + String[] of() default {}; + + /** * Include the result of the superclass's implementation of <code>toString</code> in the output. * <strong>default: false</strong> */ |