com.vaadin.flow.server.startup.
Class AbstractAnnotationValidator
- java.lang.Object
-
- com.vaadin.flow.server.startup.AbstractAnnotationValidator
-
All Implemented Interfaces:
Direct Known Subclasses:
public abstract class AbstractAnnotationValidator extends Object implements Serializable
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 Modifier and Type Field Description static String
ERROR_MESSAGE_BEGINNING
static String
MIDDLE_ROUTER_LAYOUT
static String
NON_PARENT
static String
NON_PARENT_ALIAS
static String
NON_ROUTER_LAYOUT
-
Constructor Summary
Constructors Constructor Description AbstractAnnotationValidator()
-
Method Summary
All Methods Modifier and Type Method Description protected abstract List<Class<?>>
getAnnotations()
Gets the annotations that are subject to validate.
protected String
getClassAnnotations(Class<?> clazz)
Returns the validation annotations declared for the
clazz
.static String
getClassAnnotations(Class<?> clazz, List<Class<?>> annotations)
Returns annotations declared for the
clazz
.protected String
getErrorHint()
Returns a hint for the discovered validation errors.
protected Optional<String>
handleNonRouterLayout(Class<?> clazz)
Handles the
clazz
which is not a top level route and not a router layout.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.protected void
validateClasses(Collection<Class<?>> classSet)
Validate the correctness of the annotations returned by the
getAnnotations()
method applied to theclassSet
.
-
-
-
Field Detail
-
ERROR_MESSAGE_BEGINNING
public static final String ERROR_MESSAGE_BEGINNING
See Also:
-
NON_PARENT
public static final String NON_PARENT
See Also:
-
NON_PARENT_ALIAS
public static final String NON_PARENT_ALIAS
See Also:
-
NON_ROUTER_LAYOUT
public static final String NON_ROUTER_LAYOUT
See Also:
-
MIDDLE_ROUTER_LAYOUT
public static final String MIDDLE_ROUTER_LAYOUT
See Also:
-
-
Method Detail
-
validateClasses
protected void validateClasses(Collection<Class<?>> classSet)
Validate the correctness of the annotations returned by the
getAnnotations()
method applied to theclassSet
.Parameters:
classSet
- the classes to validate
-
getAnnotations
protected abstract List<Class<?>> getAnnotations()
Gets the annotations that are subject to validate.
Returns:
a list of target annotations
-
handleNonRouterLayout
protected Optional<String> handleNonRouterLayout(Class<?> clazz)
Handles the
clazz
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 annotationsReturns:
an optional error message or empty if there is no error
-
getErrorHint
protected String getErrorHint()
Returns a hint for the discovered validation errors.
Returns:
the error hint
-
getClassAnnotations
protected String getClassAnnotations(Class<?> clazz)
Returns the validation annotations declared for the
clazz
.Parameters:
clazz
- the type to get validation annotationsReturns:
comma separated list of validation annotation declared for the
clazz
-
getClassAnnotations
public static String getClassAnnotations(Class<?> clazz, List<Class<?>> annotations)
Returns annotations declared for the
clazz
.Parameters:
clazz
- the typeannotations
- the annotation listReturns:
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 annotationReturns:
a filtered set of classes
-
-