T
- type of the transfer object (DTO)I
- type of the transportable's id. It should be an immutable type.
It is critical this type implements equals() and hashCode()
correctly.public interface Transportable<T,I extends Serializable> extends Serializable
<E extends T> Id<E,I> getId()
A type for the identified must be specified to retrieve the id because
identified objects might be inheritable. For example, assume
Employee
extends from Person
and Person
implements Transportable<Person, Long>
. The following code
would be possible.
Id<Person, Long> id = employee.getId(); Id<Employee, Long> id = employee.getId();
Copyright © 2015. All Rights Reserved.