Search in sources :

Example 1 with ElementResolver

use of com.aire.ux.test.ElementResolver in project aire-components by aire-ux.

the class PathRegistryParameterResolver method create.

@Override
public ElementResolver create(AnnotatedElement element) {
    return new ElementResolver() {

        @Override
        @SuppressWarnings("unchecked")
        public <T> T resolve() {
            val selector = element.getAnnotation(Select.class);
            val value = Utilities.firstNonDefault(selector.value(), selector.selector());
            return (T) Selection.path(value).select(Aire.getUserInterface(), UI::getCurrent, new DefaultComponentExtension<>(value, c -> {
            })).map(ExtensionDefinition::getValue).get();
        }
    };
}
Also used : lombok.val(lombok.val) ExtensionDefinition(com.aire.ux.ExtensionDefinition) ElementResolver(com.aire.ux.test.ElementResolver) DefaultComponentExtension(com.aire.ux.DefaultComponentExtension)

Aggregations

DefaultComponentExtension (com.aire.ux.DefaultComponentExtension)1 ExtensionDefinition (com.aire.ux.ExtensionDefinition)1 ElementResolver (com.aire.ux.test.ElementResolver)1 lombok.val (lombok.val)1