This repository has been archived by the owner on Jan 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from Karumi/marvel-example
Marvel example
- Loading branch information
Showing
93 changed files
with
1,904 additions
and
911 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 |
---|---|---|
|
@@ -33,4 +33,5 @@ target | |
.DS_Store | ||
Thumbs.db | ||
*.swp | ||
*.bak | ||
*.bak | ||
marvel.properties |
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 |
---|---|---|
|
@@ -26,6 +26,7 @@ buildscript { | |
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
|
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,41 @@ | ||
/* | ||
* Copyright (C) 2015 Karumi. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.karumi.rosie.mapper; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
public abstract class Mapper<T1, T2> { | ||
public abstract T2 map(T1 value); | ||
public abstract T1 reverseMap(T2 value); | ||
|
||
public Collection<T2> map(Collection<T1> values) { | ||
Collection<T2> returnValues = new ArrayList<>(); | ||
for (T1 value : values) { | ||
returnValues.add(map(value)); | ||
} | ||
return returnValues; | ||
} | ||
|
||
public Collection<T1> reverseMap(Collection<T2> values) { | ||
Collection<T1> returnValues = new ArrayList<>(); | ||
for (T2 value : values) { | ||
returnValues.add(reverseMap(value)); | ||
} | ||
return returnValues; | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
...rc/main/java/com/karumi/rosie/repository/datasource/EmptyPaginatedReadableDataSource.java
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,33 @@ | ||
/* | ||
* Copyright (C) 2015 Karumi. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.karumi.rosie.repository.datasource; | ||
|
||
import com.karumi.rosie.repository.PaginatedCollection; | ||
import com.karumi.rosie.repository.datasource.paginated.Page; | ||
import com.karumi.rosie.repository.datasource.paginated.PaginatedReadableDataSource; | ||
|
||
/** | ||
* Utility class to only override methods that are needed by your readable data source | ||
* implementation. | ||
*/ | ||
public class EmptyPaginatedReadableDataSource<K, V> extends EmptyReadableDataSource<K, V> | ||
implements PaginatedReadableDataSource<K, V> { | ||
|
||
@Override public PaginatedCollection<V> getPage(Page page) throws Exception { | ||
return null; | ||
} | ||
} |
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
Oops, something went wrong.