Polish source code.
This commit is contained in:
@@ -41,7 +41,7 @@ public class Author {
|
||||
private Long id;
|
||||
|
||||
@NonNull
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public boolean isNew() {
|
||||
return getId() == null;
|
||||
|
||||
@@ -17,14 +17,14 @@ package example.app.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* The {@link Book} class is an Abstract Data Type (ADT) modeling a book.
|
||||
*
|
||||
@@ -49,7 +49,7 @@ public class Book {
|
||||
private LocalDate publishedDate;
|
||||
|
||||
@NonNull
|
||||
private String title;
|
||||
private final String title;
|
||||
|
||||
@Transient
|
||||
public boolean isNew() {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package example.app.model;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -48,7 +47,7 @@ public class ISBN implements Comparable<ISBN> {
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
return this.number;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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