File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 30
30
# '
31
31
entity <- setClass(
32
32
" entity" ,
33
- slots = c(value = ' ANY' ),
33
+ slots = c(value = ' ANY' , max_length = ' numeric ' ),
34
34
contains = ' struct_class' ,
35
35
prototype = list (name = ' name not provided' ,
36
36
description = ' no description provided' ,
@@ -41,14 +41,17 @@ entity<-setClass(
41
41
validity = function (object ) {
42
42
check_length = length(value(object )) < = max_length(object )
43
43
check_type = class(value(object ))[1 ] %in% type(object )
44
-
44
+ check_max_length = length(max_length( object )) == 1
45
45
msg = TRUE
46
46
if (! check_length ) {
47
47
msg = paste0(name(object ),' : number of values must be less than "max_length"' )
48
48
}
49
49
if (! check_type ) {
50
50
msg = paste0(name(object ),' : class of value must match "type"' )
51
51
}
52
+ if (! check_max_length ) {
53
+ msg = paste0(name(object ),' : ' , ' max_length must be of length 1' )
54
+ }
52
55
return (msg )
53
56
}
54
57
)
You can’t perform that action at this time.
0 commit comments