Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nrktkt committed Feb 2, 2016
1 parent cd20410 commit 49489de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ HATEOAS with HAL for Java
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/blackdoor/hate)
[![Build Status](https://travis-ci.org/blackdoor/hate.svg)](https://travis-ci.org/blackdoor/hate)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/7c1d6531e44941ed9e48b75435c9f1b8)](https://www.codacy.com/app/nfischer921/hate)
[![Jitpack Badge](https://img.shields.io/badge/jitpack-available-blue.svg)](https://jitpack.io/#blackdoor/hate)
[![JitPack Badge](https://jitpack.io/v/blackdoor/hate.svg)](https://jitpack.io/#blackdoor/hate)

---
## Install with Maven
Expand Down Expand Up @@ -35,15 +35,14 @@ public class Order implements HalResource{
}

@Override
public HalRepresentation asEmbedded() {
public HalRepresentationBuilder representationBuilder() {
return HalRepresentation.builder()
.addProperty("total", total)
.addProperty("currency", currency)
.addProperty("status", status)
.addLink("basket", basket)
.addLink("customer", customer)
.addLink("self", this)
.build();
.addLink("self", this);
}
}
```
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/black/door/hate/HalRepresentation.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static black.door.hate.Constants._embedded;
import static black.door.hate.Constants._links;
import static black.door.util.Misc.require;

import static java.util.stream.Collectors.*;
import static java.util.Map.Entry;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;

/**
* Created by nfischer on 12/8/2015.
Expand Down Expand Up @@ -82,7 +81,7 @@ public static HalRepresentationBuilder paginated(
.addEmbedded(name, stream
.skip((effectivePageNumber) *pageSize)
.limit(pageSize)
.collect(Collectors.toList()))
.collect(toList()))
.addLink("next", new URI(self + "?page=" + (displayPageNumber + 1)))
.addLink("self", new URI(self +
(displayPageNumber > 1
Expand All @@ -108,7 +107,7 @@ public void serialize(HalRepresentation halRepresentation,
jsonGenerator.writeStartObject();

//write all properties to json
for(Map.Entry<String, Object> e :halRepresentation.properties.entrySet()){
for(Entry<String, Object> e :halRepresentation.properties.entrySet()){
jsonGenerator.writeObjectField(e.getKey(), e.getValue());
}

Expand Down

0 comments on commit 49489de

Please sign in to comment.