Hi,
I would like to ask if there is any way to check if a String is an
Integer using an Ocl constraint.
For example in java you can do something like:
1. Integer.parseInt(myString) and catch the exception or 2. boolean
isInteger = Pattern.matches("^\d*$", myString)
Is there any way to perform something similar to the above in OCL?
I tried to use something like self.value.oclIsTypeOf(Integer) but the
oclIsTypeOf property deals with the direct type of an object.
e.g. context Person
inv: self.oclIsTypeOf( Person ) -- is true
inv: self.oclIsTypeOf( Company) -- is false
I tried to use something like self.value.oclIsKindOf(Integer) but the
oclIsKindOf property determines whether value is either the direct type
or one of the supertypes of an object.
Any suggestions how this can be done?
Thanks,
Achilleas