GitHub user korovkin opened a pull request:

    https://github.com/apache/thrift/pull/1056

    java: adding factories to the generated Java classes

    adding factories to the generated Java classes, allowing the user to 
control the type of classes to be allocated when de-serializing the incoming 
message.
    
    example of generated code:
    
    ```
    public class Team implements ... {
    
      ...
      public static class TeamFactory {
        public Team allocate() { return new Team(); }
        public Team allocate(Team other) { return new Team(other); }
        public Team allocate(String teamId, String name, String domain, String 
email_domain, String plan) { return new Team(teamId, name, domain, 
email_domain, plan); }
      }
    
      public static volatile TeamFactory factory = new TeamFactory();
      public static void setFactory(TeamFactory f) { factory = f;}
      public static TeamFactory getFactory() { return factory;}
    
      ...
    }
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/korovkin/thrift java_factories

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/1056.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1056
    
----
commit 1228ca2e6f70f0e778a9b8d8c99bcc0795248e5c
Author: Haim Grosman <[email protected]>
Date:   2016-07-25T19:32:20Z

    factories for the generated java classes

commit 1976dc6d2b8df44210586c9be028a3b07df35735
Author: Haim Grosman <[email protected]>
Date:   2016-07-25T19:36:20Z

    cleanup

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to