mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-24 19:46:36 +01:00
Updated DataExtension API Builders (markdown)
parent
0726a8c511
commit
1931249334
@ -31,13 +31,7 @@ return builder.addValue(Long.class,
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
You can add multiple values to a single builder.
|
You can add multiple values to a single builder before returning it.
|
||||||
```java
|
|
||||||
ExtensionDataBuilder builder = newExtensionDataBuilder();
|
|
||||||
return builder.addValue(Long.class, builder.valueBuilder("Steps taken").buildNumber(53298L))
|
|
||||||
.addValue(String.class, builder.valueBuilder("Taken in").buildNumber("World Name"))
|
|
||||||
;
|
|
||||||
```
|
|
||||||
|
|
||||||
Here are the types and build methods that are available:
|
Here are the types and build methods that are available:
|
||||||
```java
|
```java
|
||||||
@ -62,6 +56,24 @@ Table.class, ...buildTable(() -> Table.builder()...build(), Color.BLUE);
|
|||||||
```
|
```
|
||||||
The lambda methods can be used for method references, conditional values (eg returning null sometimes) and for throwing `NotReadyException` for a specific value.
|
The lambda methods can be used for method references, conditional values (eg returning null sometimes) and for throwing `NotReadyException` for a specific value.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Example</summary>
|
||||||
|
|
||||||
|
```java
|
||||||
|
public ExtensionDataBuilder lotsOfServerData() {
|
||||||
|
ExtensionDataBuilder builder = newExtensionDataBuilder();
|
||||||
|
return builder.addValue(Long.class, builder.valueBuilder("Houses built")
|
||||||
|
.buildNumber(() -> {
|
||||||
|
if (database == null) throw new NotReadyException();
|
||||||
|
return database.getHouseCount();
|
||||||
|
})
|
||||||
|
).addValue(Long.class builder.valueBuilder("Superheroes")
|
||||||
|
.buildNumber(this::getSuperheroCount)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
In addition to this value builder has a lot of other methods:
|
In addition to this value builder has a lot of other methods:
|
||||||
```
|
```
|
||||||
builder.valueBuilder("Example") // 50 char limit
|
builder.valueBuilder("Example") // 50 char limit
|
||||||
|
Loading…
Reference in New Issue
Block a user