public Map < String , Object > build ( ) { final ImmutableMap . Builder < String , Object > builder = ImmutableMap . builder ( ) ; final int keyCode = ofNullable ( this . keyCode ) . orElseThrow ( ( ) -> new IllegalStateException ( "The key code must be set" ) ) ; builder . put ( "keycode" , keyCode ) ; ofNullable ( this . metaState ) . ifPresent ( x -> builder . put ( "metastate" , x ) ) ; ofNullable ( this . flags ) . ifPresent ( x -> builder . put ( "flags" , x ) ) ; return builder . build ( ) ; }
Builds a map which is ready to be used by the downstream API .