results.add( new InvalidValue( interpolate(validator), beanClass, null, bean, bean ) );
}
}
for ( int i = 0; i < memberValidators.size() ; i++ ) {
XMember getter = memberGetters.get( i );
if ( Hibernate.isPropertyInitialized( bean, getPropertyName( getter ) ) ) {
Object value = getMemberValue( bean, getter );
Validator validator = memberValidators.get( i );
if ( !validator.isValid( value ) ) {
String propertyName = getPropertyName( getter );
results.add( new InvalidValue( interpolate(validator), beanClass, propertyName, value, bean ) );
}
}
}
for ( int i = 0; i < childGetters.size() ; i++ ) {
XMember getter = childGetters.get( i );
if ( Hibernate.isPropertyInitialized( bean, getPropertyName( getter ) ) ) {
Object value = getMemberValue( bean, getter );
if ( value != null && Hibernate.isInitialized( value ) ) {
String propertyName = getPropertyName( getter );
if ( getter.isCollection() ) {
int index = 0;
boolean isIterable = value instanceof Iterable;
Map map = ! isIterable ? (Map) value : null;
Iterable elements = isIterable ?
(Iterable) value :
map.keySet();
for ( Object element : elements ) {
Object actualElement = isIterable ? element : map.get( element );
if ( actualElement == null ) {
index++;
continue;
}
InvalidValue[] invalidValues = getClassValidator( actualElement )
.getInvalidValues( actualElement, circularityState );
String indexedPropName = MessageFormat.format(
"{0}[{1}]",
propertyName,
INDEXABLE_CLASS.contains( element.getClass() ) ?
( "'" + element + "'" ) :
index
);
index++;
for ( InvalidValue invalidValue : invalidValues ) {
invalidValue.addParentBean( bean, indexedPropName );
results.add( invalidValue );
}
}
}
if ( getter.isArray() ) {
int index = 0;
for ( Object element : (Object[]) value ) {
if ( element == null ) {
index++;
continue;