Better way to only use callsuper in @EqualsAndHashCode and @ToString?

I have class where I inheritage some fields, among them my id fields and those I difference on for the object.
I am using lombok to generate my @EqualsAndHashCode and @ToString, but only want to use my super class’s version, and exclude all fields in my class.
I am wondering if there is a way to do that, without using the exclude and then add all fields.

My classes:

@EqualsAndHashCode(of = { "id" })
@ToString(of = { "id", "email", "name" })
@Data
public abstract class Resource {
    @Id
    private Integer id;

    private String name;

    private String email;
}

@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Data
public class Employee extends Resource {
    private Organisation organisation;

    private List<Skill> skills = new ArrayList<Skill>();
}

Here I will get organisation and skills in my ToString, Equals and HashCode.

To exclude them I can use:

@ToString(callSuper = true, exclude = { "organisation", "skills" })

However as I have more fields than the example, and there might come more in the future, I would prefer if I could exclude all except for the ones from my super class.

I can also add one field in with the of = {}.

Is there any better way to accomplish that?

Wouldn’t simply

@ToString(callSuper = true, of = {})

work? Lombok knows nothing about the superclass fields (as this information is unavailable at the time it runs) and you can’t include id or exclude name. All you can do is to make it call super.toString(). When you include no fields at all, then you get something like

Employee(super=Resource(43, Larvalis, larvalis@somewhere.com))

which may or mayn’t be what you want. You could instead write

public String toString() {
    return getClass().getSimpleName()
        + super.toString().replaceFirst("^[^(]+", "");
}

so you’d get just

Employee(43, Larvalis, larvalis@somewhere.com)