Polish source code.
This commit is contained in:
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package example.app.temp.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.gemfire.mapping.annotation.Region;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
// tag::class[]
|
||||
@Data
|
||||
@Region("TemperatureReadings")
|
||||
@@ -37,7 +37,7 @@ public class TemperatureReading {
|
||||
private Long timestamp = System.currentTimeMillis();
|
||||
|
||||
@NonNull
|
||||
private Integer temperature;
|
||||
private final Integer temperature;
|
||||
|
||||
@Transient
|
||||
public boolean isBoiling() {
|
||||
@@ -47,11 +47,6 @@ public class TemperatureReading {
|
||||
return temperature != null && temperature >= BOILING_TEMPERATURE;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public boolean isNormal() {
|
||||
return !(isBoiling() || isFreezing());
|
||||
}
|
||||
|
||||
@Transient
|
||||
public boolean isFreezing() {
|
||||
|
||||
@@ -60,6 +55,11 @@ public class TemperatureReading {
|
||||
return temperature != null && temperature <= FREEZING_TEMPERATURE;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public boolean isNormal() {
|
||||
return !(isBoiling() || isFreezing());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%d °F", getTemperature());
|
||||
|
||||
Reference in New Issue
Block a user