-
Notifications
You must be signed in to change notification settings - Fork 1
Object Selection Engine
The Object-Selection Engine is a system by which programmers can create Strings which describe Objects, using a Regular-Expression-like grammar. This page details how to use this system, and the features of said grammar.
The following is a list of object-description directives and their purpose:
-
{type-name}
or"{type.name.with.package.path}"
- Performs simple type-checking.Example
String
would validate"Hello, World!"
, andNumber
would validate200
-
#{id}
- Checks theid
field of the object you're attempting to validate.Example
#Dope
would validate{ 'id' : 'Dope' }
-
[{field}]
- Checks that the object you're attempting to validate has the field referred to by{field}
Example
[length]
would validate{ 'length' : 0 }
, and would also validate[1, 2, 3]
-
[{field} {op} {value}]
- Checks that the result of operation{op}
on{field}
and{value}
istrue
Example
[name == "Ryan"]
would validate{ 'name' : "Ryan" }
[length >= 3]
would validate both[1, 2, 3, 4]
and{ 'length' : 3 }