-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for reverse variable matching
Bumped Java version to 8
- Loading branch information
Showing
8 changed files
with
293 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
language: java | ||
jdk: | ||
- openjdk7 | ||
- oraclejdk7 | ||
- openjdk8 | ||
- oraclejdk8 | ||
sudo: false | ||
install: ./mvnw clean | ||
|
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,48 @@ | ||
package com.damnhandy.uri.template; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
/** | ||
* Created by nfischer on 8/14/2016. | ||
*/ | ||
public class Either<Left, Right> { | ||
public final Left left; | ||
public final Right right; | ||
|
||
private Either(Left left, Right right) { | ||
this.left = left; | ||
this.right = right; | ||
} | ||
|
||
public static <Left, Right> Either<Left, Right> left(Left left){ | ||
requireNonNull(left); | ||
return new Either<>(left, null); | ||
} | ||
|
||
public static <Left, Right> Either<Left, Right> right(Right right){ | ||
requireNonNull(right); | ||
return new Either<>(null, right); | ||
} | ||
|
||
public Object get(){ | ||
if(left == null) | ||
return right; | ||
else return left; | ||
} | ||
|
||
public boolean isLeft(){ | ||
return left != null; | ||
} | ||
|
||
public boolean isRight(){ | ||
return !isLeft(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Either{" + | ||
"left=" + left + | ||
", right=" + right + | ||
'}'; | ||
} | ||
} |
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
Oops, something went wrong.