3
3
import java .util .Arrays ;
4
4
import java .util .HashMap ;
5
5
import java .util .Map ;
6
+ import java .util .Set ;
6
7
import java .util .function .Function ;
7
8
import java .util .stream .Collectors ;
8
9
@@ -898,7 +899,7 @@ public Class<T> getResultType() {
898
899
public static final SearchScope <Commit > COMMITS = new SearchScope <>("commits" , Commit .class );
899
900
public static final SearchScope <SearchBlob > WIKI_BLOBS = new SearchScope <>("wiki_blobs" , SearchBlob .class );
900
901
901
- private static final Map <String , SearchScope > jsonLookup = Arrays .stream (new SearchScope [] {
902
+ private static final Map <String , SearchScope <?> > jsonLookup = Arrays .stream (new SearchScope [] {
902
903
PROJECTS ,
903
904
ISSUES ,
904
905
MERGE_REQUESTS ,
@@ -913,10 +914,15 @@ public Class<T> getResultType() {
913
914
.collect (Collectors .toMap (searchScope -> searchScope .jsonName , Function .identity ()));
914
915
915
916
@ JsonCreator
917
+ @ SuppressWarnings ("unchecked" )
916
918
public static <T > SearchScope <T > forValue (String value ) {
917
919
return (SearchScope <T >) jsonLookup .get (value );
918
920
}
919
921
922
+ public Set <String > values () {
923
+ return jsonLookup .keySet ();
924
+ }
925
+
920
926
@ JsonValue
921
927
public String toValue () {
922
928
return jsonName ;
@@ -958,16 +964,21 @@ public Class<T> getResultType() {
958
964
public static final GroupSearchScope <Note > NOTES = new GroupSearchScope <>("notes" , Note .class );
959
965
public static final GroupSearchScope <User > USERS = new GroupSearchScope <>("users" , User .class );
960
966
961
- private static final Map <String , GroupSearchScope > jsonLookup = Arrays .stream (new GroupSearchScope [] {
967
+ private static final Map <String , GroupSearchScope <?> > jsonLookup = Arrays .stream (new GroupSearchScope [] {
962
968
PROJECTS , ISSUES , MERGE_REQUESTS , MILESTONES , WIKI_BLOBS , COMMITS , BLOBS , NOTES , USERS ,
963
969
})
964
970
.collect (Collectors .toMap (searchScope -> searchScope .jsonName , Function .identity ()));
965
971
966
972
@ JsonCreator
973
+ @ SuppressWarnings ("unchecked" )
967
974
public static <T > GroupSearchScope <T > forValue (String value ) {
968
975
return (GroupSearchScope <T >) jsonLookup .get (value );
969
976
}
970
977
978
+ public Set <String > values () {
979
+ return jsonLookup .keySet ();
980
+ }
981
+
971
982
@ JsonValue
972
983
public String toValue () {
973
984
return jsonName ;
@@ -1008,16 +1019,21 @@ public Class<T> getResultType() {
1008
1019
new ProjectSearchScope <>("wiki_blobs" , SearchBlob .class );
1009
1020
public static final ProjectSearchScope <User > USERS = new ProjectSearchScope <>("users" , User .class );
1010
1021
1011
- private static final Map <String , ProjectSearchScope > jsonLookup = Arrays .stream (new ProjectSearchScope [] {
1022
+ private static final Map <String , ProjectSearchScope <?> > jsonLookup = Arrays .stream (new ProjectSearchScope [] {
1012
1023
BLOBS , COMMITS , ISSUES , MERGE_REQUESTS , MILESTONES , NOTES , WIKI_BLOBS , USERS ,
1013
1024
})
1014
1025
.collect (Collectors .toMap (searchScope -> searchScope .jsonName , Function .identity ()));
1015
1026
1016
1027
@ JsonCreator
1028
+ @ SuppressWarnings ("unchecked" )
1017
1029
public static <T > ProjectSearchScope <T > forValue (String value ) {
1018
1030
return (ProjectSearchScope <T >) jsonLookup .get (value );
1019
1031
}
1020
1032
1033
+ public Set <String > values () {
1034
+ return jsonLookup .keySet ();
1035
+ }
1036
+
1021
1037
@ JsonValue
1022
1038
public String toValue () {
1023
1039
return jsonName ;
0 commit comments