throw new RuntimeException("unknown object passed as constraint violation: " + o);
}
ConstraintViolation<?> v = ConstraintViolation.class.cast(o);
Iterator<Node> nodes = v.getPropertyPath().iterator();
Node firstNode = nodes.next();
if (firstNode.getKind() == ElementKind.METHOD)
{
Node secondNode = nodes.next();
if (secondNode.getKind() == ElementKind.PARAMETER ||
secondNode.getKind() == ElementKind.CROSS_PARAMETER)
{
return ConstraintType.Type.PARAMETER;
}
else if (secondNode.getKind() == ElementKind.RETURN_VALUE)
{
return ConstraintType.Type.RETURN_VALUE;
}
else
{
throw new RuntimeException("unexpected path node type in method violation: " + secondNode.getKind());
}
}
if (firstNode.getKind() == ElementKind.BEAN)
{