This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove problem and guava dependencies
- Loading branch information
1 parent
118c519
commit 8655707
Showing
20 changed files
with
193 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.zalando.fahrschein; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import static java.lang.String.format; | ||
|
||
public final class Preconditions { | ||
private Preconditions() { | ||
} | ||
|
||
public static void checkArgument(boolean expression) { | ||
if (!expression) { | ||
throw new IllegalArgumentException(); | ||
} | ||
} | ||
|
||
public static void checkArgument(boolean expression, Object errorMessage) { | ||
if (!expression) { | ||
throw new IllegalArgumentException(String.valueOf(errorMessage)); | ||
} | ||
} | ||
|
||
public static void checkArgument(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { | ||
if (!expression) { | ||
throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs)); | ||
} | ||
} | ||
|
||
public static void checkState(boolean expression) { | ||
if (!expression) { | ||
throw new IllegalStateException(); | ||
} | ||
} | ||
|
||
public static void checkState(boolean expression, Object errorMessage) { | ||
if (!expression) { | ||
throw new IllegalStateException(String.valueOf(errorMessage)); | ||
} | ||
} | ||
|
||
public static void checkState(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { | ||
if (!expression) { | ||
throw new IllegalStateException(format(errorMessageTemplate, errorMessageArgs)); | ||
} | ||
} | ||
|
||
public static <T> T checkNotNull(@Nullable T reference) { | ||
if (reference == null) { | ||
throw new NullPointerException(); | ||
} | ||
return reference; | ||
} | ||
|
||
public static <T> T checkNotNull(@Nullable T reference, Object errorMessage) { | ||
if (reference == null) { | ||
throw new NullPointerException(String.valueOf(errorMessage)); | ||
} | ||
return reference; | ||
} | ||
|
||
public static <T> T checkNotNull(@Nullable T reference, String errorMessageTemplate, Object... errorMessageArgs) { | ||
if (reference == null) { | ||
throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); | ||
} | ||
return reference; | ||
} | ||
} |
Oops, something went wrong.