Search in sources :

Example 1 with ConstraintsCheck

use of org.qi4j.runtime.composite.ConstraintsCheck in project qi4j-sdk by Qi4j.

the class EntityStateInstance method checkConstraints.

public void checkConstraints() {
    for (PropertyDescriptor propertyDescriptor : stateModel.properties()) {
        ConstraintsCheck constraints = (ConstraintsCheck) propertyDescriptor;
        Property<Object> property = this.propertyFor(propertyDescriptor.accessor());
        constraints.checkConstraints(property.get());
    }
    for (AssociationDescriptor associationDescriptor : stateModel.associations()) {
        ConstraintsCheck constraints = (ConstraintsCheck) associationDescriptor;
        Association<Object> association = this.associationFor(associationDescriptor.accessor());
        constraints.checkConstraints(association.get());
    }
// TODO Should ManyAssociations be checked too?
}
Also used : PropertyDescriptor(org.qi4j.api.property.PropertyDescriptor) ConstraintsCheck(org.qi4j.runtime.composite.ConstraintsCheck) AccessibleObject(java.lang.reflect.AccessibleObject) AssociationDescriptor(org.qi4j.api.association.AssociationDescriptor)

Aggregations

AccessibleObject (java.lang.reflect.AccessibleObject)1 AssociationDescriptor (org.qi4j.api.association.AssociationDescriptor)1 PropertyDescriptor (org.qi4j.api.property.PropertyDescriptor)1 ConstraintsCheck (org.qi4j.runtime.composite.ConstraintsCheck)1