Package com.vaadin.flow.server.startup
Class AbstractAnnotationValidator
java.lang.Object
com.vaadin.flow.server.startup.AbstractAnnotationValidator
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AnnotationValidator
,WebComponentExporterAwareValidator
Validation class that contains common logic to checks that specific
annotations are not configured wrong.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the annotations that are subject to validate.protected String
getClassAnnotations
(Class<?> clazz) Returns the validation annotations declared for theclazz
.static String
getClassAnnotations
(Class<?> clazz, List<Class<?>> annotations) Returns annotations declared for theclazz
.protected String
Returns a hint for the discovered validation errors.handleNonRouterLayout
(Class<?> clazz) Handles theclazz
which is not a top level route and not a router layout.removeHandleTypesSelfReferences
(Set<Class<?>> classSet, Object handlesTypesAnnotated) Filters the given set and removes classes (interfaces) which are mentioned in a@HandlesTypes
annotation on the given object.protected void
validateClasses
(Collection<Class<?>> classSet) Validate the correctness of the annotations returned by thegetAnnotations()
method applied to theclassSet
.
-
Field Details
-
ERROR_MESSAGE_BEGINNING
- See Also:
-
NON_PARENT
- See Also:
-
NON_PARENT_ALIAS
- See Also:
-
NON_ROUTER_LAYOUT
- See Also:
-
MIDDLE_ROUTER_LAYOUT
- See Also:
-
-
Constructor Details
-
AbstractAnnotationValidator
public AbstractAnnotationValidator()
-
-
Method Details
-
validateClasses
Validate the correctness of the annotations returned by thegetAnnotations()
method applied to theclassSet
.- Parameters:
classSet
- the classes to validate
-
getAnnotations
Gets the annotations that are subject to validate.- Returns:
- a list of target annotations
-
handleNonRouterLayout
Handles theclazz
which is not a top level route and not a router layout. Returns an optional message which describes the error having an annotation for the class.- Parameters:
clazz
- class to validate annotations- Returns:
- an optional error message or empty if there is no error
-
getErrorHint
Returns a hint for the discovered validation errors.- Returns:
- the error hint
-
getClassAnnotations
Returns the validation annotations declared for theclazz
.- Parameters:
clazz
- the type to get validation annotations- Returns:
- comma separated list of validation annotation declared for the
clazz
-
getClassAnnotations
Returns annotations declared for theclazz
.- Parameters:
clazz
- the typeannotations
- the annotation list- Returns:
- a comma separated string with the annotation names
-
removeHandleTypesSelfReferences
public static Set<Class<?>> removeHandleTypesSelfReferences(Set<Class<?>> classSet, Object handlesTypesAnnotated) Filters the given set and removes classes (interfaces) which are mentioned in a@HandlesTypes
annotation on the given object.- Parameters:
classSet
- the classes to filterhandlesTypesAnnotated
- the object with a @HandlesTypes annotation- Returns:
- a filtered set of classes
-