Skip to content

Commit

Permalink
Create reverse compatible constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
freyacodes committed Apr 8, 2018
1 parent 0e3394c commit 9fb2f2c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/main/java/com/jagrosh/discordipc/entities/Callback.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Callback
*/
public Callback()
{
this(null, null);
this((Consumer<Packet>) null, null);
}

/**
Expand Down Expand Up @@ -64,6 +64,25 @@ public Callback(Consumer<Packet> success, Consumer<String> failure)
this.failure = failure;
}

/**
* @param success The Runnable to launch after a successful process.
* @param failure The Consumer to launch if the process has an error.
*/
@Deprecated
public Callback(Runnable success, Consumer<String> failure)
{
this(p -> success.run(), failure);
}

/**
* @param success The Runnable to launch after a successful process.
*/
@Deprecated
public Callback(Runnable success)
{
this(p -> success.run(), null);
}

/**
* Gets whether or not this Callback is "empty" which is more precisely
* defined as not having a specified success {@link Consumer} and/or a
Expand Down

0 comments on commit 9fb2f2c

Please sign in to comment.