public final < T > T decode ( Object value ) { if ( value == null ) { return null ; } if ( value instanceof Collection ) { List < T > list = new ArrayList <> ( ) ; Cast . < Collection < ? > > as ( value ) . forEach ( o -> list . add ( decode ( o ) ) ) ; return Cast . as ( list ) ; } if ( value instanceof Map ) { Map < String , T > map = new HashMap <> ( ) ; Cast . < Map < ? , ? > > as ( value ) . forEach ( ( k , v ) -> map . put ( k . toString ( ) , decode ( v ) ) ) ; return Cast . as ( map ) ; } if ( value instanceof Val ) { return decodeImpl ( Cast . < Val > as ( value ) . get ( ) ) ; } return decodeImpl ( value ) ; }
Converts an object to desired type