private void writeValidatorCall ( final SourceWriter sw , final Class < ? > type , final Stage stage , final PropertyDescriptor ppropertyDescription , final boolean expandDefaultGroupSequence , final String groupsVarName ) throws UnableToCompleteException { if ( cache . isClassConstrained ( type ) && ! isIterableOrMap ( type ) ) { final BeanHelper helper = this . createBeanHelper ( type ) ; beansToValidate . add ( helper ) ; switch ( stage ) { case OBJECT : // myValidator sw . print ( helper . getValidatorInstanceName ( ) ) ; if ( expandDefaultGroupSequence ) { // .expandDefaultAndValidateClassGroups(context,object,violations,groups); sw . println ( ".expandDefaultAndValidateClassGroups(context, object, violations, " + groupsVarName + ");" ) ; } else { // .validateClassGroups(context,object,violations,groups); sw . println ( ".validateClassGroups(context, object, violations, " + groupsVarName + ");" ) ; } break ; case PROPERTY : if ( this . isPropertyConstrained ( helper , ppropertyDescription ) ) { // myValidator.validatePropertyGroups(context,object // ,propertyName, violations, groups); sw . print ( helper . getValidatorInstanceName ( ) ) ; sw . print ( ".validatePropertyGroups(context, object," ) ; sw . println ( " propertyName, violations, " + groupsVarName + ");" ) ; } break ; case VALUE : if ( this . isPropertyConstrained ( helper , ppropertyDescription ) ) { // myValidator.validateValueGroups(context,beanType // ,propertyName, value, violations, groups); sw . print ( helper . getValidatorInstanceName ( ) ) ; sw . print ( ".validateValueGroups(context, " ) ; sw . print ( helper . getTypeCanonicalName ( ) ) ; sw . println ( ".class, propertyName, value, violations, " + groupsVarName + ");" ) ; } break ; default : throw new IllegalStateException ( ) ; } } }
write validator call .