use of com.aire.ux.ExtensionDefinition 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();
}
};
}
use of com.aire.ux.ExtensionDefinition in project aire-components by aire-ux.
the class SpringExtensionRegistry method decorate.
@Override
@SuppressWarnings("unchecked")
public void decorate(Class<?> type, HasElement component) {
synchronized (lock) {
resolve(type).ifPresent(ext -> {
val selection = ext.getSelection();
val opt = selection.select(component, getUserInterface(), ext.getExtension());
opt.ifPresent(extDef -> {
val definition = (ExtensionDefinition<?>) extDef;
if (inclusionManager.decide(definition)) {
ext.decorate(definition.getValue());
}
});
});
}
}
Aggregations