code: protected final Constraint getConstraint(final Element element) {
  		Element constraintElement = element.getChild(XMLTags.CONSTRAINT);
  		if (constraintElement != null) {
  			return generator.getConstraintFactory().createModel(random, constraintElement);
  		}
  		constraintElement = element.getChild(XMLTags.CONSTRAINT_REF);
  		if (constraintElement != null) {
  			try {
  				return generator.getConstraintFactory().getModel(constraintElement);
  			} catch (IdNotFoundException e) {
  				log.error("Could not find constraint in map. Maybe it has not been initialised;"
  						+ " in this case, try rearranging order of constraints in the xml file.", e);
  			}
  		}
  		throw new IllegalStateException("No element constraint or constraint_ref could be found for " + this);
  	}
docs: Searches for the constraint child element in the element and gets a constraint from the
  factory. If there is no constraint child element, a constraint_ref element is searched and
  the constraint is taken from the factory map.
  
  @return the constraint contained in this element