1 Reply Latest reply on Oct 26, 2009 8:35 PM by Trustin Lee

    Remoting 3: Builder pattern for service registration

    David Lloyd Master

      I was looking at service registration and thought that it might be better/more user-friendly to switch this to use the builder pattern to construct the services.


      final Registration handle = endpoint.serviceBuilder()
       .setClientListener(new StringRot13ClientListener())


      final LocalServiceConfiguration<String, String> config =
       LocalServiceConfiguration.create(new StringRot13ClientListener(), String.class, String.class);
      final Registration handle = endpoint.registerService(config);

      In the latter case, you need to import the LocalServiceConfiguration class, and the create line is very long even if you wrap it. The builder approach just looks cleaner to me. The change is trivial to code, so I'd like to do it unless someone thinks this API is just too ugly.