0
# Object Methods
1
2
Automatic generation of toString, equals, and hashCode methods with extensive customization options.
3
4
## Capabilities
5
6
### @ToString
7
8
```java { .api }
9
@Target(ElementType.TYPE)
10
@Retention(RetentionPolicy.SOURCE)
11
public @interface ToString {
12
boolean includeFieldNames() default true;
13
String[] exclude() default {};
14
String[] of() default {};
15
boolean callSuper() default false;
16
boolean doNotUseGetters() default false;
17
boolean onlyExplicitlyIncluded() default false;
18
}
19
```
20
21
### @EqualsAndHashCode
22
23
```java { .api }
24
@Target(ElementType.TYPE)
25
@Retention(RetentionPolicy.SOURCE)
26
public @interface EqualsAndHashCode {
27
String[] exclude() default {};
28
String[] of() default {};
29
boolean callSuper() default false;
30
boolean doNotUseGetters() default false;
31
CacheStrategy cacheStrategy() default CacheStrategy.NEVER;
32
AnyAnnotation[] onParam() default {};
33
boolean onlyExplicitlyIncluded() default false;
34
35
public enum CacheStrategy {
36
NEVER, LAZY
37
}
38
}
39
```
40
41
**Usage Examples:**
42
43
```java
44
@ToString(exclude = "password")
45
@EqualsAndHashCode(of = {"id", "email"})
46
public class User {
47
private Long id;
48
private String email;
49
private String password;
50
private String name;
51
}
52
```