// Check if any constraint failed
if( violations != null )
{
if( instance instanceof Composite )
{
throw new ConstraintViolationException( (Composite) instance, method, violations );
}
if( instance instanceof CompositeInstance )
{
throw new ConstraintViolationException( (Composite) ( (CompositeInstance) instance ).proxy(), method, violations );
}
Iterable<? extends Class<?>> types = iterable( instance.getClass() );
throw new ConstraintViolationException( instance.toString(), (Iterable<Class<?>>) types, method, violations );
}
}