protected DataModel getDataModel() {

        // Return any previously cached DataModel instance
        if (this.model != null) {
            return (model);
        }

        // Synthesize a DataModel around our current value if possible
        Object current = getValue();
        if (current == null) {
            setDataModel(new ListDataModel(Collections.EMPTY_LIST));
        } else if (current instanceof DataModel) {
            setDataModel((DataModel) current);
        } else if (current instanceof List) {
            setDataModel(new ListDataModel((List) current));
        } else if (Object[].class.isAssignableFrom(current.getClass())) {
            setDataModel(new ArrayDataModel((Object[]) current));
        } else if (current instanceof ResultSet) {
            setDataModel(new ResultSetDataModel((ResultSet) current));
        } else if (current instanceof Result) {
            setDataModel(new ResultDataModel((Result) current));
        } else if (current instanceof Collection) {
            setDataModel(new CollectionDataModel((Collection) current));
        } else {
            setDataModel(new ScalarDataModel(current));
        }
        return (model);

    }
protected DataModel getDataModel ( ) { if ( this . model != null ) { return ( model ) ; } Object current = getValue ( ) ; if ( current == null ) { setDataModel ( new ListDataModel ( Collections . EMPTY_LIST ) ) ; } else if ( current instanceof DataModel ) { setDataModel ( ( DataModel ) current ) ; } else if ( current instanceof List ) { setDataModel ( new ListDataModel ( ( List ) current ) ) ; } else if ( Object [ ] . class . isAssignableFrom ( current . getClass ( ) ) ) { setDataModel ( new ArrayDataModel ( ( Object [ ] ) current ) ) ; } else if ( current instanceof ResultSet ) { setDataModel ( new ResultSetDataModel ( ( ResultSet ) current ) ) ; } else if ( current instanceof Result ) { setDataModel ( new ResultDataModel ( ( Result ) current ) ) ; } else if ( current instanceof Collection ) { setDataModel ( new CollectionDataModel ( ( Collection ) current ) ) ; } else { setDataModel ( new ScalarDataModel ( current ) ) ; } return ( model ) ; }
<p>Return the internal {@link DataModel} object representing the data
objects that we will iterate over in this component's rendering.</p>
<p/>
<p>If the model has been cached by a previous call to {@link
#setDataModel}, return it.  Otherwise call {@link #getValue}.  If the
result is null, create an empty {@link ListDataModel} and return it.  If
the result is an instance of {@link DataModel}, return it.  Otherwise,
adapt the result as described in {@link #getValue} and return it.</p>