Skip to content

Commit 6feb5ef

Browse files
authored
Merge pull request #21 from eviltester/eviltester/issue20
Add Java export options and docs
2 parents cdbc7c7 + 956d102 commit 6feb5ef

14 files changed

Lines changed: 1057 additions & 4 deletions

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ There is a maintained list in the documentation:
127127
- [RandExp.js](http://fent.github.io/randexp.js/) for regular expression based random data generation
128128
- http://fent.github.io/randexp.js/
129129
- [Tabulator](https://tabulator.info/) for light weight tables
130-
- [AG Grid](https://ag-grid.com) for the data table
131130
- [PapaParse](https://www.papaparse.com/) for csv processing
132131

133132
## Tool Categories

docs-src/blog/2026-04-28-more-programming-language-exports.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ draft: true
99

1010
We've expanded export options for programming-language-style output so it is easier to move table data into application code.
1111

12-
This release builds on the existing JavaScript export and adds Python export support with configurable output options.
12+
This release builds on the existing JavaScript export and adds both Python and Java export support with configurable output options.
1313

1414
<!--truncate-->
1515

@@ -30,6 +30,15 @@ Read the docs:
3030
- [Python Data Format](/docs/data-formats/python/python)
3131
- [Python Options](/docs/data-formats/python/options)
3232

33+
## Java
34+
35+
Java export supports both map-style and object-style output and includes options for collection type (list or array), variable assignment, number conversion, import inclusion, and pretty printing with custom delimiters.
36+
37+
Read the docs:
38+
39+
- [Java Data Format](/docs/data-formats/java/java)
40+
- [Java Options](/docs/data-formats/java/options)
41+
3342
## JavaScript
3443

3544
JavaScript export continues to support object-array output with configurable formatting and conversion options.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
sidebar_position: 1
3+
title: "Java"
4+
description: "Java is a programming language with collection and object models that can represent tabular data as maps, arrays, lists, and class instances. You can export grid data as Java-ready source in AnyWayData.com."
5+
---
6+
7+
Java is a programming language and the AnyWayData Java option is most useful when you want copy/paste-ready data for tests, fixtures, demos, and prototypes.
8+
9+
## What is Java Data Output?
10+
11+
Java can represent table-like data using collections of maps or collections of objects.
12+
13+
For example, a list of maps:
14+
15+
```java
16+
import java.util.Map;
17+
import java.util.List;
18+
import java.util.ArrayList;
19+
20+
List<Map<String, Object>> data = new ArrayList<>(List.of(
21+
Map.of("user", "Jesse.Bradtke97", "name", "Corine"),
22+
Map.of("user", "Cielo.Little", "name", "Zander")
23+
));
24+
```
25+
26+
In the example above:
27+
28+
- each row is represented as a map using key/value pairs
29+
- map keys come from the column headers
30+
- row maps are collected in a Java list
31+
32+
AnyWayData can also generate class-instance output where each row is represented as a named Java object.
33+
34+
## How is Java Output different from JSON and Javascript?
35+
36+
JSON is a language-independent data format and JavaScript object arrays are JavaScript syntax.
37+
38+
Java output uses Java syntax and Java concepts:
39+
40+
- rows can be emitted as `Map<String, Object>` values or named class instances
41+
- output can be generated as `List` or array collections
42+
- values can be emitted as quoted strings or numeric literals
43+
- output can be assigned to a named Java variable
44+
45+
Unlike JSON, Java output is designed to be used directly in Java source code.
46+
47+
## AnyWayData Support for Java
48+
49+
AnyWayData currently supports **exporting** data to Java format.
50+
51+
You can configure output options such as:
52+
53+
- collection type (`List` or array)
54+
- variable assignment and naming
55+
- number conversion (quoted vs unquoted)
56+
- map vs class-instance output
57+
- pretty print indentation and custom delimiter
58+
- import inclusion
59+
60+
Java output can be generated from the same grid data used for the other supported export formats.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
sidebar_position: 2
3+
title: "Java Options"
4+
description: "Options available for converting to Java in AnyWayData.com. This includes collection and object style, variable assignment, number conversion, imports, and pretty print formatting."
5+
---
6+
7+
The configuration options for Java are listed below.
8+
9+
## Collection Type
10+
11+
Choose whether the outer container is generated as:
12+
13+
- `List (ArrayList)`
14+
- `Array [ ]`
15+
16+
## Assign to Variable
17+
18+
When enabled, output is assigned to a variable.
19+
20+
For example:
21+
22+
```java
23+
List<Map<String, Object>> data = new ArrayList<>(List.of(
24+
Map.of("name", "Monica")
25+
));
26+
```
27+
28+
## Variable Name
29+
30+
Set the name used when `Assign to Variable` is enabled.
31+
32+
For example, using `records`:
33+
34+
```java
35+
List<Map<String, Object>> records = new ArrayList<>(List.of(
36+
Map.of("name", "Monica")
37+
));
38+
```
39+
40+
## Number Convert (Quote Numbers)
41+
42+
When enabled, numeric-looking values are emitted as quoted strings.
43+
44+
When disabled, numeric-looking values are emitted as numeric literals.
45+
46+
## Use Anonymous Maps (Map.of)
47+
48+
When enabled, each row is output as a map.
49+
50+
When disabled, each row is output as an instance of a named Java class.
51+
52+
For larger row shapes (more than 10 columns), AnyWayData automatically uses `Map.ofEntries(...)`.
53+
54+
## Class Name
55+
56+
Used when `Use Anonymous Maps` is disabled to set the class name for generated row instances.
57+
58+
## Blank Values
59+
60+
Choose how blank values are exported:
61+
62+
- `null`
63+
- `Empty String`
64+
65+
## Include Imports
66+
67+
When enabled, import statements are included at the top of the output.
68+
69+
Depending on selected options, imports can include:
70+
71+
```java
72+
import java.util.Map;
73+
import java.util.List;
74+
import java.util.ArrayList;
75+
```
76+
77+
## Pretty Print
78+
79+
Controls whether output is formatted across multiple lines with indentation.
80+
81+
When disabled, output is compact (minified style).
82+
83+
## Delimiter
84+
85+
Controls indentation when `Pretty Print` is enabled.
86+
87+
Java supports:
88+
89+
- `Tab [\t]`
90+
- `Space [ ]`
91+
- `Custom Value`
92+
93+
## Custom Delimiter
94+
95+
Set a custom indentation value used for pretty print.
96+
97+
For Java output, indentation must be whitespace. Non-whitespace values automatically fall back to safe spaces.

js/data_formats/file-types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fileTypes['markdown'] = { type: 'markdown', fileExtension: '.md' };
88
fileTypes['json'] = { type: 'json', fileExtension: '.json' };
99
fileTypes['javascript'] = { type: 'javascript', fileExtension: '.js' };
1010
fileTypes['python'] = { type: 'python', fileExtension: '.py' };
11+
fileTypes['java'] = { type: 'java', fileExtension: '.java' };
1112
fileTypes['gherkin'] = { type: 'gherkin', fileExtension: '.gherkin' };
1213
fileTypes['html'] = { type: 'html', fileExtension: '.html' };
1314
fileTypes['asciitable'] = { type: 'asciitable', fileExtension: '.txt' };

0 commit comments

Comments
 (0)