public class AnnotationMetadataProvider extends Object implements MetadataProvider
PropertyMetadata based on previously registered annotations. Each field together with its setter and getter are scanned.| Constructor and Description |
|---|
AnnotationMetadataProvider() |
| Modifier and Type | Method and Description |
|---|---|
Collection<PropertyMetadata> |
getMetadata(String name,
Field field,
Method setter,
Method getter)
Collects
PropertyMetadata for a given property. |
void |
registerAnnotation(String name,
Class<? extends Annotation> annotation)
Registers the given annotation to be discovered during scanning and maps it to a
boolean PropertyMetadata. |
<V,A extends Annotation> |
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. |
AnnotationMetadataProvider |
withRegisteredAnnotation(String name,
Class<? extends Annotation> annotation)
Chains
registerAnnotation(String, Class) and returns itself. |
<V,A extends Annotation> |
withRegisteredAnnotation(String name,
Class<A> annotation,
Class<V> type,
com.vaadin.flow.function.SerializableFunction<A,V> valueFunction)
Chains
registerAnnotation(String, Class, Class, SerializableFunction) and returns itself. |
public Collection<PropertyMetadata> getMetadata(String name, Field field, Method setter, Method getter)
MetadataProviderPropertyMetadata for a given property.getMetadata in interface MetadataProvidername - Name of the property.field - A Field that corresponds to the property. Will not be null, but may not be accessible.setter - A Method that is a setter for the given field. May be null if there is no setter.getter - A Method that is a getter for the given field. May be null if there is no getter.null, but possibly empty, collection of PropertyMetadata.public <V,A extends Annotation> void registerAnnotation(String name, Class<V> type, Class<A> annotation, com.vaadin.flow.function.SerializableFunction<A,V> valueFunction)
PropertyMetadata.A - Annotation type.V - Metadata value type.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.public final <V,A extends Annotation> AnnotationMetadataProvider withRegisteredAnnotation(String name, Class<A> annotation, Class<V> type, com.vaadin.flow.function.SerializableFunction<A,V> valueFunction)
registerAnnotation(String, Class, Class, SerializableFunction) and returns itself.A - Annotation type.V - Metadata value type.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(String, Class, Class, SerializableFunction)public void registerAnnotation(String name, Class<? extends Annotation> annotation)
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.name - Name of the metadata.annotation - Annotation to map.public final AnnotationMetadataProvider withRegisteredAnnotation(String name, Class<? extends Annotation> annotation)
registerAnnotation(String, Class) and returns itself.name - Name of the metadata.annotation - Annotation to map.registerAnnotation(String, Class)Copyright © 2023 Miki. All rights reserved.