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