Skip to content

Commit 26361b9

Browse files
committed
In relation to Java Issue #314; update the documentation to reflect updated syntax
1 parent d9d6a79 commit 26361b9

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/connections/sources/catalog/libraries/server/java/index.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add to `pom.xml`:
3838
or if you're using Gradle:
3939

4040
```bash
41-
compile 'com.segment.analytics.java:analytics:+'
41+
implementation 'com.segment.analytics.java:analytics:+'
4242
```
4343

4444
### Initialize the SDK
@@ -74,14 +74,13 @@ We recommend calling `identify` a single time when the user's account is first c
7474
Example `identify` call:
7575

7676
```java
77+
Map<String, String> map = new HashMap();
78+
map.put("name", "Michael Bolton");
79+
map.put("email", "[email protected]");
80+
7781
analytics.enqueue(IdentifyMessage.builder()
78-
.userId("f4ca124298")
79-
.traits(ImmutableMap.builder()
80-
.put("name", "Michael Bolton")
81-
.put("email", "[email protected]")
82-
.build()
83-
)
84-
);
82+
.userId("f4ca124298")
83+
.traits(map));
8584
```
8685

8786
This call is identifying Michael by his unique User ID (the one you know him by in your database) and labeling him with `name` and `email` traits.

src/connections/sources/catalog/libraries/server/java/quickstart.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Here's what it would look like with Maven:
4040
*or if you're using Gradle:*
4141

4242
```bash
43-
compile 'com.segment.analytics.java:analytics:+'
43+
implementation 'com.segment.analytics.java:analytics:+'
4444
```
4545

4646
## Step 3: Initialize the SDK
@@ -71,14 +71,13 @@ The `identify` message is how you tell Segment who the current user is. It inclu
7171
Here's what a basic call to `identify` a user might look like:
7272

7373
```java
74+
Map<String, String> map = new HashMap();
75+
map.put("name", "Michael Bolton");
76+
map.put("email", "[email protected]");
77+
7478
analytics.enqueue(IdentifyMessage.builder()
75-
.userId("f4ca124298")
76-
.traits(ImmutableMap.builder()
77-
.put("name", "Michael Bolton")
78-
.put("email", "[email protected]")
79-
.build()
80-
)
81-
);
79+
.userId("f4ca124298")
80+
.traits(map));
8281
```
8382

8483
**Note:** The enqueue method takes a `MessageBuilder` instance and not a `Message` instance directly. This is to allow you to use a `MessageTransformer` that applies to all incoming messages and transform or add data. <!-- LR: Can't find that we ever had a doc about this. Read more about it in the [transformer reference docs](/docs/connections/sources/catalog/libraries/server/java#transformer).-->

0 commit comments

Comments
 (0)