Browse Source

Fix checkstyle issues in samples

Fix checkstyle issues with samples following the
spring-javaformat upgrade.

See gh-13932
pull/14003/head
Phillip Webb 8 years ago
parent
commit
9ca9a491ca
  1. 2
      spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java
  2. 2
      spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java
  3. 10
      spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/domain/VehicleIdentificationNumber.java
  4. 10
      spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleDetails.java
  5. 2
      spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/echo/DefaultEchoService.java
  6. 2
      spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/echo/DefaultEchoService.java
  7. 2
      spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/echo/DefaultEchoService.java

2
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java

@ -25,7 +25,7 @@ public interface HotelSummary { @@ -25,7 +25,7 @@ public interface HotelSummary {
Double getAverageRating();
default Integer getAverageRatingRounded() {
return (getAverageRating() != null ? (int) Math.round(getAverageRating()) : null);
return (getAverageRating() != null) ? (int) Math.round(getAverageRating()) : null;
}
}

2
spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java

@ -91,7 +91,7 @@ class HotelServiceImpl implements HotelService { @@ -91,7 +91,7 @@ class HotelServiceImpl implements HotelService {
@Override
public long getNumberOfReviewsWithRating(Rating rating) {
Long count = this.ratingCount.get(rating);
return (count != null ? count : 0);
return (count != null) ? count : 0;
}
}

10
spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/domain/VehicleIdentificationNumber.java

@ -33,11 +33,6 @@ public final class VehicleIdentificationNumber { @@ -33,11 +33,6 @@ public final class VehicleIdentificationNumber {
this.vin = vin;
}
@Override
public int hashCode() {
return this.vin.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -49,6 +44,11 @@ public final class VehicleIdentificationNumber { @@ -49,6 +44,11 @@ public final class VehicleIdentificationNumber {
return this.vin.equals(((VehicleIdentificationNumber) obj).vin);
}
@Override
public int hashCode() {
return this.vin.hashCode();
}
@Override
public String toString() {
return this.vin;

10
spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleDetails.java

@ -49,11 +49,6 @@ public class VehicleDetails { @@ -49,11 +49,6 @@ public class VehicleDetails {
return this.model;
}
@Override
public int hashCode() {
return this.make.hashCode() * 31 + this.model.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -66,4 +61,9 @@ public class VehicleDetails { @@ -66,4 +61,9 @@ public class VehicleDetails {
return this.make.equals(other.make) && this.model.equals(other.model);
}
@Override
public int hashCode() {
return this.make.hashCode() * 31 + this.model.hashCode();
}
}

2
spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/echo/DefaultEchoService.java

@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { @@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
private final String echoFormat;
public DefaultEchoService(String echoFormat) {
this.echoFormat = (echoFormat != null ? echoFormat : "%s");
this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
}
@Override

2
spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/echo/DefaultEchoService.java

@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { @@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
private final String echoFormat;
public DefaultEchoService(String echoFormat) {
this.echoFormat = (echoFormat != null ? echoFormat : "%s");
this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
}
@Override

2
spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/echo/DefaultEchoService.java

@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { @@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
private final String echoFormat;
public DefaultEchoService(String echoFormat) {
this.echoFormat = (echoFormat != null ? echoFormat : "%s");
this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
}
@Override

Loading…
Cancel
Save