-
Notifications
You must be signed in to change notification settings - Fork 0
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 #38 from icgc-argo/rc/2.4.0
Rc/2.4.0
- Loading branch information
Showing
6 changed files
with
96 additions
and
22 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
24 changes: 24 additions & 0 deletions
24
src/main/java/bio/overture/songsearch/utils/CommonUtils.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,24 @@ | ||
package bio.overture.songsearch.utils; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import java.util.Map; | ||
import lombok.extern.slf4j.Slf4j; | ||
import lombok.val; | ||
|
||
@Slf4j | ||
public final class CommonUtils { | ||
|
||
private CommonUtils() {} | ||
|
||
public static <K, V> ImmutableMap<K, V> asImmutableMap(Object obj) { | ||
val newMap = ImmutableMap.<K, V>builder(); | ||
if (obj instanceof Map) { | ||
try { | ||
newMap.putAll((Map<? extends K, ? extends V>) obj); | ||
} catch (ClassCastException e) { | ||
log.error("Failed to cast obj to Map<K,V>"); | ||
} | ||
} | ||
return newMap.build(); | ||
} | ||
} |
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