'Migrate builder to Spring hateoas 2.6.7

I have this old code implemented in hateoas:1.0

  public class StaticPathLinkBuilder extends LinkBuilderSupport<StaticPathLinkBuilder> {

  @Override
  protected StaticPathLinkBuilder createNewInstance(UriComponentsBuilder builder) {
    return new StaticPathLinkBuilder(builder);
  }

I updated my code to hateoas 2.6.7 but the code is changed this way:

public class StaticPathLinkBuilder extends LinkBuilderSupport<StaticPathLinkBuilder> {

@Override
  protected StaticPathLinkBuilder createNewInstance(UriComponents components, List<Affordance> affordances) {
    return null;
  }

What is the proper way to implement this change? I tried this:

  @Override
  protected StaticPathLinkBuilder createNewInstance(UriComponents components, List<Affordance> affordances) {
    return new StaticPathLinkBuilder(UriComponentsBuilder.newInstance().uriComponents(components));
  }

But it's not clear how I have to implement the code that I can send affordances.

Can you advice what is the proper way to implement this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source