0

If you have a constructor that takes a lot of parameters, like this:

  public OrgUnitsHalRepresentation(List<OrgUnitSummaryHalRepresentation> orgUnitSummaryHalRepresentationList,
  int count, int providedCount, int total, int page, int filterLimit, boolean hasNextPage, boolean isDefaultCount)

You can use a separate class that takes nothing in the constructor and set these parameters using setters and pass in this into the constructor instead:

public OrgUnitsHalRepresentation(Pagination(Name of pattern) p)

Does this have a name so that I can use it in my class name?

12

This is the Parameter Object Design Pattern (or Argument Object), the related Refactoring is called Introduce Parameter Object.

1

This seems to me like a normal case of grouping related variables into compact structure, that has been practiced since structures were invented. Considering it is so ancient, I would imagine there is no name for it.

Also, remember one thing : Patterns are much complex than that. Pattern usually means something that introduces SOLID into code. Your case is too simple to be considered pattern. I would simply call it "PaginationParameters"

  • 1
    I disagree. Anything that is a common solution can be named as a 'pattern'. For example: the Null Object pattern. It's really simple and is considered a pattern. – Aviv Cohn Aug 1 '14 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.