File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed
app/src/main/java/hexlet/code/schemas Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 33public abstract class BaseSchema <T > {
44 protected boolean isRequired = false ;
55
6- public BaseSchema <T > required () {
6+ @ SuppressWarnings ("unchecked" )
7+ public T required () {
78 this .isRequired = true ;
8- return this ;
9+ return ( T ) this ;
910 }
1011
1112 public abstract boolean isValid (Object value );
Original file line number Diff line number Diff line change 22
33import java .util .Map ;
44
5- public class MapSchema extends BaseSchema <Map < String , ?> > {
5+ public class MapSchema extends BaseSchema <MapSchema > {
66 private int requiredSize = -1 ;
77 private Map <String , BaseSchema <?>> schemas ;
88
@@ -17,8 +17,8 @@ public MapSchema sizeof(int size) {
1717 return this ;
1818 }
1919
20- public MapSchema shape (Map <String , BaseSchema <?>> shapeSchemas ) {
21- this .schemas = shapeSchemas ;
20+ public MapSchema shape (Map <String , ? extends BaseSchema <?>> shapeSchemas ) {
21+ this .schemas = ( Map < String , BaseSchema <?>>) shapeSchemas ;
2222 return this ;
2323 }
2424
Original file line number Diff line number Diff line change 11package hexlet .code .schemas ;
22
3- public class NumberSchema extends BaseSchema <Number > {
3+ public class NumberSchema extends BaseSchema <NumberSchema > {
44 private boolean isPositive = false ;
55 private int minRange = Integer .MIN_VALUE ;
66 private int maxRange = Integer .MAX_VALUE ;
Original file line number Diff line number Diff line change 11package hexlet .code .schemas ;
22
3- public class StringSchema extends BaseSchema <String > {
3+ public class StringSchema extends BaseSchema <StringSchema > {
44 private int minLength = 0 ;
55 private String containsSubstring = null ;
66
You can’t perform that action at this time.
0 commit comments