Search in sources :

Example 1 with Synchronize

use of com.vaadin.flow.component.Synchronize in project flow by vaadin.

the class ComponentMetaData method doCollectSynchronizedProperties.

private static void doCollectSynchronizedProperties(Class<?> clazz, Map<String, SynchronizedPropertyInfo> infos) {
    for (Method method : clazz.getDeclaredMethods()) {
        Synchronize annotation = method.getAnnotation(Synchronize.class);
        if (annotation == null) {
            continue;
        }
        if (!ReflectTools.isGetter(method)) {
            throw new IllegalStateException(method + " is annotated with @" + Synchronize.class.getSimpleName() + " even though it's not a getter.");
        }
        if (infos.containsKey(method.getName())) {
            continue;
        }
        String propertyName;
        if (annotation.property().isEmpty()) {
            propertyName = ReflectTools.getPropertyName(method);
        } else {
            propertyName = annotation.property();
        }
        String[] eventNames = annotation.value();
        infos.put(method.getName(), new SynchronizedPropertyInfo(propertyName, eventNames, annotation.allowUpdates()));
    }
}
Also used : Synchronize(com.vaadin.flow.component.Synchronize) Method(java.lang.reflect.Method)

Aggregations

Synchronize (com.vaadin.flow.component.Synchronize)1 Method (java.lang.reflect.Method)1