@ Override public String initValuesImpl ( final FieldCase ca ) { if ( ca == FieldCase . NULL || ca == FieldCase . BLANK ) { return null ; } // If there still is an mandatory case, a value will be generated anyway if ( ca != null || last && constraint . hasNextCase ( ) || generator . isIgnoreOptionalConstraints ( ) ) { return constraint . initValues ( ca ) ; } if ( choice . isNext ( ) ) { last = true ; return constraint . initValues ( null ) ; } // Initialize the field below with 0 as optional equals false last = false ; constraint . initValues ( FieldCase . NULL ) ; return null ; }
Returns either null or a value . If null is returned the embedded constraint is initialized with FieldCase . NULL . If a value is returned the embedded constraint is initialized with the FieldCase whose value is returned . If the latest value was not not null the next value will be generated if in the case that the embedded constraint still has an mandatory case . This also applies if all optional constraints have been turned of globally using the property IGNORE_CONSTRAINT_OPTIONAL . Otherwise no value will be generated in 50% of the cases or the values of the embedded constraints are returned .