public class ConstrainedPropertyRuntimeHints extends java.lang.Object implements RuntimeHintsRegistrar
Registers the constrained property a domain class's constraints are applied to.
A constraint that names no registered Constraint is applied by setting a property of
the same name, through Groovy rather than by a call the compiler can see:
((GroovyObject) this).setProperty(constraintName, constrainingValue). So
password: true is a reflective invocation of setPassword(boolean), and an image
keeps only the members something asks for.
Without these, an application starts and then fails the first time a domain instance is validated, naming a setter nobody wrote:
MissingReflectionRegistrationError: Cannot reflectively invoke method 'public void grails.gorm.validation.DefaultConstrainedProperty.setPassword(boolean)'
Registered here rather than left to a tracing agent because an agent records only the constraints the run it watched happened to evaluate. Validation is lazy -- the evaluator is built the first time something is validated -- so an application whose data already exists never validates during tracing and records nothing, and the same image then fails against an empty database. Which of the two an image was traced against is not a property anyone would think to keep constant.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
registerHints(RuntimeHints hints, java.lang.ClassLoader classLoader) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |