vendredi 13 mai 2016

Design Patterns - What pattern is this?

Lets say I have the following structure in java:

@MappedSuperClass
public class User extends AbstractEntity { ... }

@Entity
public class SuperUser extends User { ... }

@Entity
public class RegularUser extends User { ... }

This project is structured in RESTful endpoints with 3 layers (Resources, Services and Repositories) with generic abstractions:

public class UserRepository<T extends AbstractEntity> { ... }

now I want to have some DB methods executed over all types of User, so I created this Repository layer:

public class UserRepository extends AbstractRepository<User> { ... }

Can it be called an Adapter or maybe Bridge, since its executing logic that kinda encapsulate the funcionality of two other classes (RegularUserRepository and SuperUserRepository)?

Aucun commentaire:

Enregistrer un commentaire