From 49489de489136c29ddc0486f2da709c3c2cc4ea8 Mon Sep 17 00:00:00 2001 From: Nathaniel Fischer Date: Sun, 31 Jan 2016 23:14:29 -0800 Subject: [PATCH] Update README.md --- README.md | 7 +++---- src/main/java/black/door/hate/HalRepresentation.java | 9 ++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a045f40..b060012 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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); } } ``` diff --git a/src/main/java/black/door/hate/HalRepresentation.java b/src/main/java/black/door/hate/HalRepresentation.java index 5e46abb..81e5da2 100644 --- a/src/main/java/black/door/hate/HalRepresentation.java +++ b/src/main/java/black/door/hate/HalRepresentation.java @@ -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. @@ -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 @@ -108,7 +107,7 @@ public void serialize(HalRepresentation halRepresentation, jsonGenerator.writeStartObject(); //write all properties to json - for(Map.Entry e :halRepresentation.properties.entrySet()){ + for(Entry e :halRepresentation.properties.entrySet()){ jsonGenerator.writeObjectField(e.getKey(), e.getValue()); }