public Object getListFieldValue ( String fieldName , int index ) { Object ret = null ; Object val = getFieldValue ( fieldName , true ) ; // internal if ( val instanceof List < ? > ) { List < ? > list = ( List < ? > ) val ; Object cval = list . get ( index ) ; DomainObject gdo = getForRawObject ( cval ) ; if ( gdo != null ) ret = gdo ; else ret = cval ; } else if ( val != null && val . getClass ( ) . isArray ( ) ) { Object aval = Array . get ( val , index ) ; DomainObject gdo = getForRawObject ( aval ) ; if ( gdo != null ) ret = gdo ; else ret = aval ; } 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" ) ; } return ret ; }
if the field is a list or array answer the value at the given index .