9
9
import java .time .LocalDate ;
10
10
import java .time .ZonedDateTime ;
11
11
import java .util .ArrayList ;
12
+ import java .util .Collections ;
12
13
import java .util .HashSet ;
13
14
import java .util .LinkedHashMap ;
14
15
import java .util .LinkedHashSet ;
17
18
import java .util .Objects ;
18
19
import java .util .Set ;
19
20
20
- public interface Schema < T extends Map , U extends List > extends SchemaValidator {
21
+ public interface Schema extends SchemaValidator {
21
22
private static Object castToAllowedTypes (Object arg , List <Object > pathToItem , PathToTypeMap pathToType ) {
22
23
if (arg == null ) {
23
24
pathToType .put (pathToItem , Void .class );
@@ -36,7 +37,7 @@ private static Object castToAllowedTypes(Object arg, List<Object> pathToItem, Pa
36
37
Object fixedVal = castToAllowedTypes (val , newPathToItem , pathToType );
37
38
argFixed .put (key , fixedVal );
38
39
}
39
- return argFixed ;
40
+ return new FrozenMap ( argFixed ) ;
40
41
} else if (arg instanceof Boolean ) {
41
42
pathToType .put (pathToItem , Boolean .class );
42
43
return arg ;
@@ -116,7 +117,7 @@ private static LinkedHashMap<String, Object> getProperties(Object arg, List<Obje
116
117
Object castValue = getNewInstance (propertyClass , value , propertyPathToItem , pathToSchemas );
117
118
properties .put (propertyName , castValue );
118
119
}
119
- return properties ;
120
+ return new FrozenMap ( properties ) ;
120
121
}
121
122
122
123
private static List <Object > getItems (Object arg , List <Object > pathToItem , PathToSchemasMap pathToSchemas ) {
@@ -209,11 +210,11 @@ static String validate(Class<?> cls, LocalDate arg, SchemaConfiguration configur
209
210
return (String ) validateObject (cls , arg , configuration );
210
211
}
211
212
212
- static <T extends Map > T validate (Class <?> cls , T arg , SchemaConfiguration configuration ) {
213
+ static <T extends FrozenMap > T validate (Class <?> cls , Map < String , Object > arg , SchemaConfiguration configuration ) {
213
214
return (T ) validateObject (cls , arg , configuration );
214
215
}
215
216
216
- static <U extends List > U validate (Class <?> cls , U arg , SchemaConfiguration configuration ) {
217
+ static <U extends List > U validate (Class <?> cls , List < Object > arg , SchemaConfiguration configuration ) {
217
218
return (U ) validateObject (cls , arg , configuration );
218
219
}
219
220
0 commit comments