private boolean isCascadeRequired(ValidationContext<?, ?> validationContext, ValueContext<?, ?> valueContext, ElementType type) {
boolean isReachable;
boolean isCascadable;
PathImpl path = valueContext.getPropertyPath();
Path pathToObject = path.getPathWithoutLeafNode();
// HV-524 - class level constraints are reachable
if ( ElementType.TYPE.equals( type ) ) {
isReachable = true;
}
else {
try {
isReachable = validationContext.getTraversableResolver().isReachable(
valueContext.getCurrentBean(),
path.getLeafNode(),
validationContext.getRootBeanClass(),
pathToObject,
type
);
}
catch ( RuntimeException e ) {
throw log.getErrorDuringCallOfTraversableResolverIsReachableException( e );
}
}
if ( ElementType.TYPE.equals( type ) ) {
isCascadable = true;
}
else {
try {
isCascadable = validationContext.getTraversableResolver().isCascadable(
valueContext.getCurrentBean(),
path.getLeafNode(),
validationContext.getRootBeanClass(),
pathToObject,
type
);
}