SBT Play enhancer

Sorry in advance if i’ve placed this in the wrong category.

Quick (hopefully) question about the Play Enhancer, the sbt plugin which “generates getters and setters for Java beans, and rewrites the code that accesses those fields to use the getters and setters.”

This text above, taken from https://www.playframework.com/documentation/2.6.x/PlayEnhancer
along with “This plugin provides byte code enhancement to Play 2.4+ projects, generating getters and setters for any Java sources, and rewriting accessors for any classes that depend on them.”
https://github.com/playframework/play-enhancer

are about the only documentation I can find on what it does.

That might sound clear for simple types such as ‘String’, Integer etc
But what actually does it do for a List, or List or something more complex?
Actually, I am at this point primarily interested in what it does with List members.

Is there more documentation somewhere?

Best Regards,

Sean

Hi @svaens,

There is no additional documentation, but play-enhancer does not do anything fancier than generate getters and setters. So, for you List example, it would do something like:

public class User {
    public String name;
    public boolean admin;
    public List<String> phoneNumbers;
}

It will generate code equivalent to:

public class User {
    public String name;
    public boolean admin;
    public List<String> phoneNumbers;

    public String getName() {
        return name;
    }

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

    public boolean isAdmin() {
        return admin;
    }

    public void setAdmin(boolean admin) {
        this.admin = admin;
    }

    public List<String> getPhoneNumbers() {
        return phoneNumbers;
    }

    public void setPhoneNumbers(List<String> phoneNumbers) {
        this.phoneNumbers = phoneNumbers;
    }
}

In other words, it does not generates methods to manipulate the list, create defensive copies or anything like that.

Ah, good to know.

Thanks!