Browse Source
This commit removes OptionalParameter in favor of the nullness support introduced in Spring Framework 7. The parameter of an action can now be flagged as optional using JSpecify's @Nullable, and simplifies the setup for those who are using JSpecify as only a single annotation is required. Closes gh-45390pull/47162/head
30 changed files with 71 additions and 345 deletions
@ -1,36 +0,0 @@
@@ -1,36 +0,0 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
|
||||
package org.springframework.boot.configurationsample; |
||||
|
||||
import java.lang.annotation.Documented; |
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
/** |
||||
* Alternative to Spring Boot's {@code @OptionalParameter} for testing (removes the need |
||||
* for a dependency on the real annotation). |
||||
* |
||||
* @author Phillip Webb |
||||
*/ |
||||
@Target({ ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD }) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
public @interface OptionalParameter { |
||||
|
||||
} |
||||
@ -1,36 +0,0 @@
@@ -1,36 +0,0 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
|
||||
package org.springframework.boot.configurationsample.endpoint; |
||||
|
||||
import org.springframework.boot.configurationsample.Endpoint; |
||||
import org.springframework.boot.configurationsample.OptionalParameter; |
||||
import org.springframework.boot.configurationsample.ReadOperation; |
||||
|
||||
/** |
||||
* An endpoint that uses {@code OptionalParameter} to signal an optional parameter. |
||||
* |
||||
* @author Wonyong Hwang |
||||
*/ |
||||
@Endpoint(id = "optional") |
||||
public class OptionalParameterEndpoint { |
||||
|
||||
@ReadOperation |
||||
public String invoke(@OptionalParameter String parameter) { |
||||
return "test with " + parameter; |
||||
} |
||||
|
||||
} |
||||
@ -1,36 +0,0 @@
@@ -1,36 +0,0 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
|
||||
package org.springframework.boot.actuate.endpoint.annotation; |
||||
|
||||
import java.lang.annotation.Documented; |
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
/** |
||||
* Annotation that indicates that an operation parameter is optional. |
||||
* |
||||
* @author Phillip Webb |
||||
* @since 4.0.0 |
||||
*/ |
||||
@Target({ ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD }) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
public @interface OptionalParameter { |
||||
|
||||
} |
||||
Loading…
Reference in new issue