mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
move dto parameters to constructor in order to create an immutable object
This commit is contained in:
@@ -12,7 +12,9 @@ public class NamespaceStrategiesDto extends HalRepresentation {
|
||||
private String current;
|
||||
private List<String> available;
|
||||
|
||||
public NamespaceStrategiesDto(Links links) {
|
||||
public NamespaceStrategiesDto(String current, List<String> available, Links links) {
|
||||
super(links);
|
||||
this.current = current;
|
||||
this.available = available;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,15 +43,10 @@ public class NamespaceStrategyResource {
|
||||
@Path("")
|
||||
@Produces(VndMediaType.NAMESPACE_STRATEGIES)
|
||||
public NamespaceStrategiesDto get(@Context UriInfo uriInfo) {
|
||||
NamespaceStrategiesDto dto = new NamespaceStrategiesDto(createLinks(uriInfo));
|
||||
|
||||
String currentStrategy = strategyAsString(namespaceStrategyProvider.get());
|
||||
dto.setCurrent(currentStrategy);
|
||||
|
||||
List<String> availableStrategies = collectStrategyNames();
|
||||
dto.setAvailable(availableStrategies);
|
||||
|
||||
return dto;
|
||||
return new NamespaceStrategiesDto(currentStrategy, availableStrategies, createLinks(uriInfo));
|
||||
}
|
||||
|
||||
private Links createLinks(@Context UriInfo uriInfo) {
|
||||
|
||||
Reference in New Issue
Block a user