Class CodeWarnings
java.lang.Object
org.springframework.beans.factory.aot.CodeWarnings
Helper class to register warnings that the compiler may trigger on
generated code.
- Since:
- 6.1
- Author:
- Stephane Nicoll
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetectDeprecation(AnnotatedElement... elements) Detect the presence ofDeprecatedon the specified elements.detectDeprecation(Stream<AnnotatedElement> elements) Detect the presence ofDeprecatedon the specified elements.detectDeprecation(ResolvableType resolvableType) Detect the presence ofDeprecatedon the signature of the specifiedResolvableType.Return the currently registered warnings.voidRegister a warning to be included for this block.protected voidConsume the builder forSuppressWarningsif necessary.voidsuppress(org.springframework.javapoet.MethodSpec.Builder method) IncludeSuppressWarningson the specified method if necessary.voidsuppress(org.springframework.javapoet.TypeSpec.Builder type) IncludeSuppressWarningson the specified type if necessary.toString()
-
Constructor Details
-
CodeWarnings
public CodeWarnings()
-
-
Method Details
-
register
Register a warning to be included for this block. Does nothing if the warning is already registered.- Parameters:
warning- the warning to register, if it hasn't been already
-
detectDeprecation
Detect the presence ofDeprecatedon the specified elements.- Parameters:
elements- the elements to check- Returns:
thisinstance
-
detectDeprecation
Detect the presence ofDeprecatedon the specified elements.- Parameters:
elements- the elements to check- Returns:
thisinstance
-
detectDeprecation
Detect the presence ofDeprecatedon the signature of the specifiedResolvableType.- Parameters:
resolvableType- a type signature- Returns:
thisinstance- Since:
- 6.1.8
-
suppress
public void suppress(org.springframework.javapoet.MethodSpec.Builder method) IncludeSuppressWarningson the specified method if necessary.- Parameters:
method- the method to update
-
suppress
public void suppress(org.springframework.javapoet.TypeSpec.Builder type) IncludeSuppressWarningson the specified type if necessary.- Parameters:
type- the type to update
-
suppress
protected void suppress(Consumer<org.springframework.javapoet.AnnotationSpec.Builder> annotationSpec) Consume the builder forSuppressWarningsif necessary. If this instance has no warnings registered, the consumer is not invoked.- Parameters:
annotationSpec- a consumer of theAnnotationSpec.Builder- See Also:
-
getWarnings
-
toString
-