Class AnnotationMetadataProvider

  • All Implemented Interfaces:
    MetadataProvider

    public class AnnotationMetadataProvider
    extends Object
    implements MetadataProvider
    Provides PropertyMetadata based on previously registered annotations. Each field together with its setter and getter are scanned.
    Since:
    2022-09-01
    Author:
    miki
    • Constructor Detail

      • AnnotationMetadataProvider

        public AnnotationMetadataProvider()
    • Method Detail

      • registerAnnotation

        public <V,​A extends Annotation> void registerAnnotation​(String name,
                                                                      Class<V> type,
                                                                      Class<A> annotation,
                                                                      com.vaadin.flow.function.SerializableFunction<A,​V> valueFunction)
        Registers the given annotation to be discovered during scanning and maps it to a PropertyMetadata.
        Type Parameters:
        A - Annotation type.
        V - Metadata value type.
        Parameters:
        name - Name of the metadata.
        type - Value type of the metadata.
        annotation - Annotation to map.
        valueFunction - Function to obtain the value from the given annotation.
      • registerAnnotation

        public void registerAnnotation​(String name,
                                       Class<? extends Annotation> annotation)
        Registers the given annotation to be discovered during scanning and maps it to a boolean PropertyMetadata. Only the presence of the annotation will result in creation of the metadata and setting its value to true. This means that the absence of the annotation will not create the metadata.
        Parameters:
        name - Name of the metadata.
        annotation - Annotation to map.