Add nullability annotations to smoke-test/spring-boot-smoke-test-data-rest
See gh-46587
This commit is contained in:
parent
f34770811e
commit
d7496924cb
|
|
@ -23,6 +23,7 @@ import jakarta.persistence.Entity;
|
|||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@Entity
|
||||
public class City implements Serializable {
|
||||
|
|
@ -32,26 +33,32 @@ public class City implements Serializable {
|
|||
@Id
|
||||
@SequenceGenerator(name = "city_generator", sequenceName = "city_sequence", initialValue = 23)
|
||||
@GeneratedValue(generator = "city_generator")
|
||||
private Long id;
|
||||
private @Nullable Long id;
|
||||
|
||||
@Column(nullable = false)
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String name;
|
||||
|
||||
@Column(nullable = false)
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String state;
|
||||
|
||||
@Column(nullable = false)
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String country;
|
||||
|
||||
@Column(nullable = false)
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String map;
|
||||
|
||||
protected City() {
|
||||
}
|
||||
|
||||
public City(String name, String country) {
|
||||
public City(String name, String country, String state, String map) {
|
||||
this.name = name;
|
||||
this.country = country;
|
||||
this.state = state;
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import jakarta.persistence.Id;
|
|||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
import org.hibernate.annotations.NaturalId;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@Entity
|
||||
public class Hotel implements Serializable {
|
||||
|
|
@ -34,28 +35,34 @@ public class Hotel implements Serializable {
|
|||
@Id
|
||||
@SequenceGenerator(name = "hotel_generator", sequenceName = "hotel_sequence", initialValue = 28)
|
||||
@GeneratedValue(generator = "hotel_generator")
|
||||
private Long id;
|
||||
private @Nullable Long id;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@NaturalId
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private City city;
|
||||
|
||||
@Column(nullable = false)
|
||||
@NaturalId
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String name;
|
||||
|
||||
@Column(nullable = false)
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String address;
|
||||
|
||||
@Column(nullable = false)
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String zip;
|
||||
|
||||
protected Hotel() {
|
||||
}
|
||||
|
||||
public Hotel(City city, String name) {
|
||||
public Hotel(City city, String name, String address, String zip) {
|
||||
this.city = city;
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.zip = zip;
|
||||
}
|
||||
|
||||
public City getCity() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@NullMarked
|
||||
package smoketest.data.rest.domain;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@NullMarked
|
||||
package smoketest.data.rest;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
@ -24,10 +24,7 @@ public class CitySearchCriteria implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String name;
|
||||
|
||||
public CitySearchCriteria() {
|
||||
}
|
||||
private final String name;
|
||||
|
||||
public CitySearchCriteria(String name) {
|
||||
Assert.notNull(name, "'name' must not be null");
|
||||
|
|
@ -38,8 +35,4 @@ public class CitySearchCriteria implements Serializable {
|
|||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@NullMarked
|
||||
package smoketest.data.rest.service;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
Loading…
Reference in New Issue