From 1931249334685b47d3beb255f86bf01335e013e0 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Wed, 7 Apr 2021 20:03:42 +0300 Subject: [PATCH] Updated DataExtension API Builders (markdown) --- DataExtension-API-Builders.md | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/DataExtension-API-Builders.md b/DataExtension-API-Builders.md index e854251..388625d 100644 --- a/DataExtension-API-Builders.md +++ b/DataExtension-API-Builders.md @@ -31,13 +31,7 @@ return builder.addValue(Long.class, ); ``` -You can add multiple values to a single builder. -```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")) -; -``` +You can add multiple values to a single builder before returning it. Here are the types and build methods that are available: ```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. +
+Example + +```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) + ); +``` + +
+ In addition to this value builder has a lot of other methods: ``` builder.valueBuilder("Example") // 50 char limit