Object Identification

User interface technologies often require to identify an object by some unique identifier. The generated DTO classes provide a simple implementation to support that requirement. The parent class of all DTO classes provides the following methods:

public abstract class AbstractDto implements Serializable {

    ...

    public Object getId() {
        ...
    }

    public void setId(String id) {
        ...
    }

    ...

}

With manually written code you can make use of these methods. If desired, you can also overwrite the method Object getId() in DTO classes that inerit from AbstractDto and let it return a value of one of the DTO class’ properties. Other generators that generate code that uses DTO classes can rely on these methods to be present to identify objects, e.g. to identify a certain row in a displayed list of data records.