Skip to content

Commit

Permalink
#101: Added toString to Takes and Responses.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdragan committed Sep 29, 2015
1 parent e3f1155 commit d9a2c2f
Show file tree
Hide file tree
Showing 59 changed files with 120 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/auth/RsLogout.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.takes.facets.auth;

import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;
import org.takes.rs.RsWithCookie;
import org.takes.rs.RsWrap;
Expand All @@ -37,6 +38,7 @@
* @version $Id$
* @since 0.1
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsLogout extends RsWrap {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/auth/TkAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.IOException;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Request;
import org.takes.Response;
import org.takes.Take;
Expand All @@ -40,6 +41,7 @@
* @version $Id$
* @since 0.1
*/
@ToString(of = { "origin", "pass", "header" })
@EqualsAndHashCode(of = { "origin", "pass", "header" })
public final class TkAuth implements Take {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/auth/TkSecure.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.IOException;
import java.util.logging.Level;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Request;
import org.takes.Response;
import org.takes.Take;
Expand All @@ -41,6 +42,7 @@
* @version $Id$
* @since 0.1
*/
@ToString(of = { "origin", "loc" })
@EqualsAndHashCode(of = { "origin", "loc" })
public final class TkSecure implements Take {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/fallback/TkFallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.InputStream;
import java.net.HttpURLConnection;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.HttpException;
import org.takes.Request;
import org.takes.Response;
Expand All @@ -43,6 +44,7 @@
* @since 0.1
* @checkstyle IllegalCatchCheck (500 lines)
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@SuppressWarnings("PMD.AvoidCatchingThrowable")
public final class TkFallback extends TkWrap {
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/org/takes/facets/flash/RsFlash.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;
import org.takes.misc.Sprintf;
import org.takes.rs.RsWithCookie;
Expand Down Expand Up @@ -87,12 +88,14 @@
* @version $Id$
* @since 0.1
*/
@ToString(callSuper = true, of = "text")
@EqualsAndHashCode(callSuper = true)
public final class RsFlash extends RsWrap {

/**
* To string.
*/
@SuppressWarnings("unused")
private final transient String text;

/**
Expand Down Expand Up @@ -152,11 +155,6 @@ public RsFlash(final String msg, final Level level, final String cookie)
this.text = String.format("%s/%s", level, msg);
}

@Override
public String toString() {
return this.text;
}

/**
* Make a response.
* @param msg Message
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/flash/TkFlash.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.IOException;
import java.util.Iterator;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Request;
import org.takes.Response;
import org.takes.Take;
Expand Down Expand Up @@ -58,6 +59,7 @@
* @version $Id$
* @since 0.1
*/
@ToString(of = { "origin", "cookie" })
@EqualsAndHashCode(of = { "origin", "cookie" })
public final class TkFlash implements Take {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/fork/RsFork.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.net.HttpURLConnection;
import java.util.Arrays;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.HttpException;
import org.takes.Request;
import org.takes.Response;
Expand All @@ -43,6 +44,7 @@
* @version $Id$
* @since 0.6
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsFork extends RsWrap {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/fork/TkConsumes.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.IOException;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Request;
import org.takes.Response;
import org.takes.Take;
Expand All @@ -39,6 +40,7 @@
* @version $Id$
* @since 1.0
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class TkConsumes extends TkWrap {
/**
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/fork/TkFork.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Collection;
import java.util.Collections;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.HttpException;
import org.takes.Request;
import org.takes.Response;
Expand Down Expand Up @@ -62,6 +63,7 @@
* @see org.takes.facets.fork.FkRegex
* @see org.takes.facets.fork.FkParams
*/
@ToString(of = "forks")
@EqualsAndHashCode(of = "forks")
public final class TkFork implements Take {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/fork/TkMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.takes.facets.fork;

import java.util.Arrays;
import lombok.ToString;
import org.takes.Take;
import org.takes.tk.TkWrap;

Expand All @@ -34,6 +35,7 @@
* @author Aleksey Popov ([email protected])
* @version $Id$
*/
@ToString(callSuper = true)
public class TkMethods extends TkWrap {
/**
* Ctor.
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/fork/TkProduces.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.IOException;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Request;
import org.takes.Response;
import org.takes.Take;
Expand All @@ -39,6 +40,7 @@
* @version $Id$
* @since 0.14
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class TkProduces extends TkWrap {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/forward/RsFailure.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.facets.flash.RsFlash;

/**
Expand All @@ -38,6 +39,7 @@
* @version $Id$
* @since 0.18
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class RsFailure extends RsForward {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/forward/RsForward.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.InputStream;
import java.net.HttpURLConnection;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.HttpException;
import org.takes.Response;
import org.takes.misc.Sprintf;
Expand All @@ -44,6 +45,7 @@
* @version $Id$
* @since 0.1
*/
@ToString(callSuper = true, of = "origin")
@EqualsAndHashCode(callSuper = true, of = "origin")
public class RsForward extends HttpException implements Response {

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/takes/facets/forward/TkForward.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Request;
import org.takes.Response;
import org.takes.Take;
Expand All @@ -43,6 +44,7 @@
* @since 0.1
* @see org.takes.facets.forward.TkForward
*/
@ToString(of = "origin")
@EqualsAndHashCode(of = "origin")
public final class TkForward implements Take {

Expand Down Expand Up @@ -73,6 +75,7 @@ public Response act(final Request req) throws IOException {
/**
* Safe response.
*/
@ToString(of = { "origin", "saved" })
private static final class Safe implements Response {
/**
* Original response.
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/ret/RsReturn.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import lombok.ToString;
import org.takes.Response;
import org.takes.rs.RsWithCookie;
import org.takes.rs.RsWrap;
Expand All @@ -40,6 +41,7 @@
* @version $Id$
* @since 0.20
*/
@ToString(callSuper = true)
public final class RsReturn extends RsWrap {
/**
* Ctor.
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/ret/TkReturn.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.nio.charset.Charset;
import java.util.Iterator;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Request;
import org.takes.Response;
import org.takes.Take;
Expand All @@ -44,6 +45,7 @@
* @version $Id$
* @since 0.20
*/
@ToString(of = { "origin", "cookie" })
@EqualsAndHashCode(of = { "origin", "cookie" })
public final class TkReturn implements Take {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/facets/slf4j/TkLogged.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import java.io.IOException;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Request;
import org.takes.Response;
import org.takes.Take;
Expand All @@ -38,6 +39,7 @@
* @version $Id$
* @since 0.11.2
*/
@ToString(of = { "origin", "target" })
@EqualsAndHashCode(of = { "origin", "target" })
public final class TkLogged implements Take {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/rs/RsBuffered.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.IOException;
import java.io.InputStream;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;

/**
Expand All @@ -38,6 +39,7 @@
* @version $Id$
* @since 0.16
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsBuffered extends RsWrap {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/rs/RsEmpty.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.InputStream;
import java.util.Collections;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;

/**
Expand All @@ -38,6 +39,7 @@
* @version $Id$
* @since 0.1
*/
@ToString
@EqualsAndHashCode
public final class RsEmpty implements Response {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/rs/RsFluent.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.InputStream;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;

/**
Expand All @@ -36,6 +37,7 @@
* @version $Id$
* @since 0.1
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsFluent extends RsWrap {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/rs/RsGzip.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.zip.GZIPOutputStream;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;

/**
Expand All @@ -42,6 +43,7 @@
* @version $Id$
* @since 0.10
*/
@ToString(of = "origin")
@EqualsAndHashCode(of = "origin")
public final class RsGzip implements Response {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/rs/RsHTML.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.net.HttpURLConnection;
import java.net.URL;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;

/**
Expand All @@ -38,6 +39,7 @@
* @version $Id$
* @since 0.1
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsHTML extends RsWrap {

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/takes/rs/RsJSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.json.JsonStructure;
import javax.json.JsonWriter;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;

/**
Expand All @@ -41,6 +42,7 @@
* @version $Id$
* @since 0.1
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsJSON extends RsWrap {

Expand Down
Loading

0 comments on commit d9a2c2f

Please sign in to comment.