public Map < String , Object > toMap ( ) { Map < String , Object > retVal = new TreeMap <> ( ) ; for ( Map . Entry < String , Object > entry : attributes . entrySet ( ) ) { Object v = entry . getValue ( ) ; if ( v != null ) { if ( v instanceof Clob ) { retVal . put ( entry . getKey ( ) . toLowerCase ( ) , Convert . toString ( v ) ) ; } else { retVal . put ( entry . getKey ( ) . toLowerCase ( ) , v ) ; } } } for ( Entry < Class , Model > parent : cachedParents . entrySet ( ) ) { retVal . put ( underscore ( parent . getKey ( ) . getSimpleName ( ) ) , parent . getValue ( ) . toMap ( ) ) ; } for ( Entry < Class , List < Model > > cachedChild : cachedChildren . entrySet ( ) ) { List < Model > children = cachedChild . getValue ( ) ; List < Map > childMaps = new ArrayList <> ( children . size ( ) ) ; for ( Model child : children ) { childMaps . add ( child . toMap ( ) ) ; } retVal . put ( tableize ( cachedChild . getKey ( ) . getSimpleName ( ) ) , childMaps ) ; } return retVal ; }
Returns all values of the model with all attribute names converted to lower case regardless how these names came from DB . This method is a convenience method for displaying values on web pages .