Skip to content

Commit 8ad85bc

Browse files
committed
Update Structure example in README
Fix a few intellij complains in the README as well Signed-off-by: Justin Abrahms <justin@abrah.ms>
1 parent aeb14f6 commit 8ad85bc

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

README.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ This library is intended to be used in server-side contexts and has not been eva
1717

1818
## Usage
1919

20-
While `Boolean` provides the simplest introduction, we offer a variety of flag types.
20+
While `Boolean` provides the simplest introduction, we offer a variety of flag types.
2121

2222
```java
23+
import dev.openfeature.javasdk.Structure;
24+
2325
class MyClass {
2426
public UI booleanExample() {
2527
// Should we render the redesign? Or the default webpage?
@@ -28,23 +30,25 @@ class MyClass {
2830
}
2931
return render_normal();
3032
}
31-
33+
3234
public Template stringExample() {
3335
// Get the template to load for the custom new homepage
34-
String template = client.getStringValue("homepage_template", "default-homepage.html")
36+
String template = client.getStringValue("homepage_template", "default-homepage.html");
3537
return render_template(template);
3638
}
37-
38-
public List<Module> numberExample() {
39+
40+
public List<HomepageModule> numberExample() {
3941
// How many modules should we be fetching?
4042
Integer count = client.getIntegerValue("module-fetch-count", 4);
4143
return fetch_modules(count);
4244
}
43-
44-
public Module structureExample() {
45-
// This deserializes into the Module structure for you.
46-
Module heroModule = client.getObjectValue("hero-module", myExampleModule);
47-
return heroModule;
45+
46+
public HomepageModule structureExample() {
47+
Structure obj = client.getObjectValue("hero-module", previouslyDefinedDefaultStructure);
48+
return HomepageModule.builder()
49+
.title(obj.getValue("title"))
50+
.body(obj.getValue("description"))
51+
.build();
4852
}
4953
}
5054
```
@@ -109,7 +113,7 @@ We are also present on the `#openfeature` channel in the [CNCF slack](https://sl
109113
Thanks so much to our contributors.
110114

111115
<a href="https://github.com/open-feature/java-sdk/graphs/contributors">
112-
<img src="https://contrib.rocks/image?repo=open-feature/java-sdk" />
116+
<img src="https://contrib.rocks/image?repo=open-feature/java-sdk" alt="Pictures of the folks who have contributed to the project"/>
113117
</a>
114118

115119
Made with [contrib.rocks](https://contrib.rocks).

0 commit comments

Comments
 (0)