protected Map < String , List < Object > > buildImmutableAttributeMap ( final Map < String , List < Object > > attributes ) { final Map < String , List < Object > > immutableValuesBuilder = this . createImmutableAttributeMap ( attributes . size ( ) ) ; final Pattern arrayPattern = Pattern . compile ( "\\{(.*)\\}" ) ; for ( final Map . Entry < String , List < Object > > attrEntry : attributes . entrySet ( ) ) { final String key = attrEntry . getKey ( ) ; List < Object > value = attrEntry . getValue ( ) ; if ( value != null ) { if ( ! value . isEmpty ( ) ) { final Object result = value . get ( 0 ) ; if ( Array . class . isInstance ( result ) ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Column {} is classified as a SQL array" , key ) ; } final String values = result . toString ( ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Converting SQL array values {} using pattern {}" , values , arrayPattern . pattern ( ) ) ; } final Matcher matcher = arrayPattern . matcher ( values ) ; if ( matcher . matches ( ) ) { final String [ ] groups = matcher . group ( 1 ) . split ( "," ) ; value = Arrays . asList ( groups ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Converted SQL array values {}" , values ) ; } } } } value = Collections . unmodifiableList ( value ) ; } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Collecting attribute {} with value(s) {}" , key , value ) ; } immutableValuesBuilder . put ( key , value ) ; } return immutableValuesBuilder ; }
Take the constructor argument and convert the Map and List values into read - only form .