com.vaadin.fusion.
Class ExplicitNullableTypeChecker
- java.lang.Object
-
- com.vaadin.fusion.ExplicitNullableTypeChecker
-
public class ExplicitNullableTypeChecker extends Object
A checker for TypeScript null compatibility in Vaadin endpoint methods parameter and return types.
-
-
Constructor Summary
Constructors Constructor and Description ExplicitNullableTypeChecker()
-
Method Summary
All Methods Modifier and Type Method and Description String
checkValueForAnnotatedElement(Object value, AnnotatedElement annotatedElement)
Validates the given value for the given expected method return value type.
static boolean
isRequired(AnnotatedElement element)
Checks if the reflected element should be required (not nullable) in the generated Typescript code based on annotations.
static boolean
isRequired(List<com.github.javaparser.ast.expr.AnnotationExpr> annotations)
Checks if the parsed node should be required (not nullable) in the generated Typescript code based on the list of annotations.
-
-
-
Method Detail
-
isRequired
public static boolean isRequired(AnnotatedElement element)
Checks if the reflected element should be required (not nullable) in the generated Typescript code based on annotations.
Parameters:
element
- an element to be requiredReturns:
a result of check
-
isRequired
public static boolean isRequired(List<com.github.javaparser.ast.expr.AnnotationExpr> annotations)
Checks if the parsed node should be required (not nullable) in the generated Typescript code based on the list of annotations.
Parameters:
annotations
- a list of node annotations to checkReturns:
a result of check
-
checkValueForAnnotatedElement
public String checkValueForAnnotatedElement(Object value, AnnotatedElement annotatedElement)
Validates the given value for the given expected method return value type.
Parameters:
value
- the value to validateannotatedElement
- the entity to be type checkedReturns:
error message when the value is null while the expected type does not explicitly allow null, or null meaning the value is OK.
-
-