#977 - Simplified recreation of LinkBuilderSupport.
LinkBuilderSupport's constructor now obtains a UriComponentsBuilder in a less complicated way. Benchmarks before: Benchmark Mode Cnt Score Error Units ControllerLinkBuilderBenchmark.simpleLinkCreation thrpt 20 40,462 ± 1,572 ops/s Benchmarks after: Benchmark Mode Cnt Score Error Units ControllerLinkBuilderBenchmark.simpleLinkCreation thrpt 20 41,158 ± 0,624 ops/s
This commit is contained in:
@@ -63,7 +63,7 @@ public abstract class LinkBuilderSupport<T extends LinkBuilder> implements LinkB
|
||||
|
||||
protected LinkBuilderSupport(UriComponentsBuilder builder, List<Affordance> affordances) {
|
||||
|
||||
Assert.notNull(builder, "UriComponents must not be null!");
|
||||
Assert.notNull(builder, "UriComponentsBuilder must not be null!");
|
||||
Assert.notNull(affordances, "Affordances must not be null!");
|
||||
|
||||
this.builder = builder.cloneBuilder();
|
||||
@@ -72,12 +72,10 @@ public abstract class LinkBuilderSupport<T extends LinkBuilder> implements LinkB
|
||||
|
||||
protected LinkBuilderSupport(UriComponents components, List<Affordance> affordances) {
|
||||
|
||||
String uriString = components.toUriString();
|
||||
UriComponentsBuilder builder = uriString.isEmpty() //
|
||||
? UriComponentsBuilder.fromUri(components.toUri()) //
|
||||
: UriComponentsBuilder.fromUriString(uriString);
|
||||
Assert.notNull(components, "UriComponents must not be null!");
|
||||
Assert.notNull(affordances, "Affordances must not be null!");
|
||||
|
||||
this.builder = builder;
|
||||
this.builder = UriComponentsBuilder.fromUriString(components.toUriString());
|
||||
this.affordances = affordances;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user