change it to generics type pattern