@@ -16,7 +16,7 @@ public abstract class BaseFilter<T> {
16
16
private LocalDateTime datetimeMin ;
17
17
private LocalDateTime datetimeMax ;
18
18
private List <String > mimeType ;
19
- private String type ;
19
+ private List < String > typeList ;
20
20
private String status ;
21
21
private List <String > antiKeyPrefix ;
22
22
private List <String > antiKeySuffix ;
@@ -27,7 +27,7 @@ public abstract class BaseFilter<T> {
27
27
public BaseFilter (List <String > keyPrefix , List <String > keySuffix , List <String > keyInner , List <String > keyRegex ,
28
28
List <String > antiKeyPrefix , List <String > antiKeySuffix , List <String > antiKeyInner ,
29
29
List <String > antiKeyRegex , List <String > mimeType , List <String > antiMimeType , LocalDateTime putTimeMin ,
30
- LocalDateTime putTimeMax , String type , String status ) throws IOException {
30
+ LocalDateTime putTimeMax , List < String > typeList , String status ) throws IOException {
31
31
this .keyPrefix = keyPrefix ;
32
32
this .keySuffix = keySuffix ;
33
33
this .keyInner = keyInner ;
@@ -40,7 +40,7 @@ public BaseFilter(List<String> keyPrefix, List<String> keySuffix, List<String> k
40
40
this .antiMimeType = antiMimeType ;
41
41
this .datetimeMin = putTimeMin ;
42
42
this .datetimeMax = putTimeMax ;
43
- this .type = type == null ? "" : type ;
43
+ this .typeList = typeList ;
44
44
this .status = status == null ? "" : status ;
45
45
if (!checkKeyCon () && !checkMimeTypeCon () && !checkDatetimeCon () && !checkTypeCon () && !checkStatusCon ())
46
46
throw new IOException ("all conditions are invalid." );
@@ -64,7 +64,7 @@ public boolean checkDatetimeCon() {
64
64
}
65
65
66
66
public boolean checkTypeCon () {
67
- return type != null && ! "" . equals ( type );
67
+ return checkList ( typeList );
68
68
}
69
69
70
70
public boolean checkStatusCon () {
@@ -128,7 +128,9 @@ public boolean filterDatetime(T item) {
128
128
public boolean filterType (T item ) {
129
129
try {
130
130
if (item == null ) return false ;
131
- return valueFrom (item , ConvertingUtils .defaultTypeField ).equals (type );
131
+ String type = valueFrom (item , ConvertingUtils .defaultTypeField );
132
+ for (String s : typeList ) if (type .equals (s )) return true ;
133
+ return false ;
132
134
} catch (NullPointerException e ) {
133
135
return true ;
134
136
}
0 commit comments