mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-01 07:04:01 +01:00
Updated DataExtension API Builders (markdown)
parent
74ae57de23
commit
a19f0e3a64
@ -26,7 +26,7 @@ In the most simple form:
|
|||||||
```java
|
```java
|
||||||
ExtensionDataBuilder builder = newExtensionDataBuilder();
|
ExtensionDataBuilder builder = newExtensionDataBuilder();
|
||||||
return builder.addValue(Long.class,
|
return builder.addValue(Long.class,
|
||||||
builder.valueBuilder("Steps taken")
|
builder.valueBuilder("Steps taken") // The text should be different for each value
|
||||||
.buildNumber(53298L)
|
.buildNumber(53298L)
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
@ -35,24 +35,26 @@ You can add multiple values to a single builder before returning it.
|
|||||||
|
|
||||||
Here are the types and build methods that are available:
|
Here are the types and build methods that are available:
|
||||||
```java
|
```java
|
||||||
builder.addValue(Boolean.class, builder.valueBuilder("Example").buildBoolean(false));
|
ExtensionDataBuilder builder = newExtensionDataBuilder();
|
||||||
|
|
||||||
Boolean.class, ...buildBoolean(false));
|
builder.addValue(Boolean.class, builder.valueBuilder("...").buildBoolean(false));
|
||||||
Boolean.class, ...buildBoolean(() -> false));
|
builder.addValue(Boolean.class, builder.valueBuilder("...").buildBoolean(() -> false));
|
||||||
Boolean.class, ...buildBooleanProvidingCondition(false, "conditionName")); // for use with @Conditional on other provider annotations
|
// for use with @Conditional on other provider annotations
|
||||||
Boolean.class, ...buildBooleanProvidingCondition(() -> false, "conditionName")); // for use with @Conditional on other provider annotations
|
builder.addValue(Boolean.class, builder.valueBuilder("...").buildBooleanProvidingCondition(false, "conditionName"));
|
||||||
Long.class, ...buildNumber(1234L));
|
// for use with @Conditional on other provider annotations
|
||||||
Long.class, ...buildNumber(() -> 1234L));
|
builder.addValue(Boolean.class, builder.valueBuilder("...").buildBooleanProvidingCondition(() -> false, "conditionName"));
|
||||||
Double.class, ...buildDouble(500.52));
|
builder.addValue(Long.class, builder.valueBuilder("...").buildNumber(1234L));
|
||||||
Double.class, ...buildDouble(() ->500.52));
|
builder.addValue(Long.class, builder.valueBuilder("...").buildNumber(() -> 1234L));
|
||||||
Double.class, ...buildPercentage(0.52));
|
builder.addValue(Double.class, builder.valueBuilder("...").buildDouble(500.52));
|
||||||
Double.class, ...buildPercentage(() -> 0.52));
|
builder.addValue(Double.class, builder.valueBuilder("...").buildDouble(() ->500.52));
|
||||||
String.class, ...buildString("Example"));
|
builder.addValue(Double.class, builder.valueBuilder("...").buildPercentage(0.52));
|
||||||
String.class, ...buildString(() -> "Example"));
|
builder.addValue(Double.class, builder.valueBuilder("...").buildPercentage(() -> 0.52));
|
||||||
String[].class, ...buildGroup(new String[]{"Admin", "Moderator"}));
|
builder.addValue(String.class, builder.valueBuilder("...").buildString("Example"));
|
||||||
String[].class, ...buildGroup(() -> new String[]{"Admin", "Moderator"}));
|
builder.addValue(String.class, builder.valueBuilder("...").buildString(() -> "Example"));
|
||||||
Table.class, ...buildTable(Table.builder()...build(), Color.BLUE);
|
builder.addValue(String[].class, builder.valueBuilder("...").buildGroup(new String[]{"Admin", "Moderator"}));
|
||||||
Table.class, ...buildTable(() -> Table.builder()...build(), Color.BLUE);
|
builder.addValue(String[].class, builder.valueBuilder("...").buildGroup(() -> new String[]{"Admin", "Moderator"}));
|
||||||
|
builder.addValue(Table.class, builder.valueBuilder("...").buildTable(Table.builder()...build(), Color.BLUE));
|
||||||
|
builder.addValue(Table.class, builder.valueBuilder("...").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.
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ private DataValue<Long> superheroCountValue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private long getSuperheroCount() {
|
private long getSuperheroCount() {
|
||||||
return 0; // TODO implement later eh? :D
|
return 0; // TODO implement later
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user