Skip to content

Commit daec4e3

Browse files
authored
feat: add data converter interface (#8930)
* feat: add data converter interface * refactor: move converter and update javadocs * docs: remove database mention * refactor: remove leftovers
1 parent 61fbbe9 commit daec4e3

4 files changed

Lines changed: 58 additions & 4 deletions

File tree

‎vaadin-ai-components-flow-parent/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
This project provides interfaces for building AI-powered applications with LLM integration
44
and [Vaadin Flow](https://github.com/vaadin/flow).
55

6-
## Using the component in a Flow application
6+
## Using the components in a Flow application
77

8-
To use the component in an application using maven,
8+
To use the components in an application using maven,
99
add the following dependency to your `pom.xml`:
1010
```
1111
<dependency>

‎vaadin-ai-components-flow-parent/vaadin-ai-components-flow/pom.xml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
</dependencies>
2424
</dependencyManagement>
2525
<dependencies>
26+
<dependency>
27+
<groupId>com.vaadin</groupId>
28+
<artifactId>vaadin-charts-flow</artifactId>
29+
<version>${project.version}</version>
30+
</dependency>
2631
<dependency>
2732
<groupId>com.vaadin</groupId>
2833
<artifactId>vaadin-flow-components-base</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2000-2026 Vaadin Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package com.vaadin.flow.component.ai.chart;
17+
18+
import java.io.Serializable;
19+
import java.util.List;
20+
import java.util.Map;
21+
22+
import com.vaadin.flow.component.charts.model.Series;
23+
24+
/**
25+
* Converts tabular data into chart {@link Series} for rendering. The input is a
26+
* list of rows, where each row is a column-name-to-value map.
27+
* <p>
28+
* Implementations may return one or more series depending on the data.
29+
* </p>
30+
*
31+
* @author Vaadin Ltd
32+
*/
33+
public interface DataConverter extends Serializable {
34+
35+
/**
36+
* Converts tabular data into one or more chart series.
37+
* <p>
38+
* Each element in the input list represents a single row, with column names
39+
* as keys and column values as values.
40+
* </p>
41+
*
42+
* @param data
43+
* the tabular data to convert, not {@code null}
44+
* @return a list of series ready for use in a chart, never {@code null} and
45+
* never empty
46+
* @throws NullPointerException
47+
* if data is {@code null}
48+
*/
49+
List<Series> convertToSeries(List<Map<String, Object>> data);
50+
}

‎vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/test/java/com/vaadin/flow/component/ai/AIComponentsSerializableTest.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ protected Stream<String> getExcludedPatterns() {
5353
return Stream.concat(super.getExcludedPatterns(), Stream.of(
5454
"com\\.vaadin\\.flow\\.component\\.upload\\.receivers\\.TempDirectory\\$LazyHolder",
5555
"com\\.vaadin\\.flow\\.component\\.upload\\.receivers\\.TempDirectory",
56+
"com\\.vaadin\\.flow\\.component\\.charts\\.model\\.serializers\\..*",
5657
"com\\.vaadin\\.flow\\.component\\.ai\\.provider\\..*",
5758
"com\\.vaadin\\.flow\\.component\\.ai\\.AIComponentsFeatureFlagProvider",
58-
// AIOrchestrator — private constructor, requires LLMProvider
59-
"com\\.vaadin\\.flow\\.component\\.ai\\.orchestrator\\.AIOrchestrator",
6059
"com\\.vaadin\\.flow\\.component\\.ai\\.orchestrator\\.AIOrchestrator\\$Reconnector",
6160
"com\\.vaadin\\.flow\\.component\\.ai\\.orchestrator\\.AIOrchestrator\\$Builder"));
6261
}

0 commit comments

Comments
 (0)