public void clearListField ( String fieldName ) { Object val = getFieldValue ( fieldName , true ) ; // internal if ( val instanceof List < ? > ) ( ( List < ? > ) val ) . clear ( ) ; else if ( val != null && val . getClass ( ) . isArray ( ) ) { DOField fld = getDomainObjectType ( ) . getFieldByName ( fieldName ) ; String ctn = fld . getComponentTypeName ( ) ; Class < ? > clazz ; try { clazz = getDomainObjectType ( ) . getDomainModel ( ) . getClassForName ( ctn ) ; tryInitListOrArray ( null , fld , clazz ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } } else { if ( ! getDomainObjectType ( ) . getFieldByName ( fieldName ) . isListOrArray ( ) ) throw new RuntimeException ( "field: [" + fieldName + "] is neither list nor array" ) ; if ( val == null ) throw new RuntimeException ( "list or array field: [" + fieldName + "] is null" ) ; } }
Removes all of the elements from the list field .