Support immutable datamodels
----------------------------

                 Key: STS-836
                 URL: http://www.stripesframework.org/jira/browse/STS-836
             Project: Stripes
          Issue Type: Improvement
    Affects Versions: Release 1.5.6
            Reporter: Tim Chen


At the moment Stripes does not support creation of immutable datamodels.
So if you have an actionbean such as:

{code}
public class TestAction implements ActionBean {
    private TestUser testUser;

/// -- snipped 

    public TestUser getTestUser() {
        return testUser;
    }

    public void setTestUser(TestUser testUser) {
        this.testUser = testUser;
    }
}
{code}

Where TestUser is an immutable class, the current 
DefaultActionBeanPropertyBinder will not support creation of TestUser.
While in this example it is easy to implement an ActionBeanPropertyBinder that 
could potentially do this for you, it is becomes less trivial when you have 
List<TestUser> as your property.

Indexed Property handling is done in DefaultActionBeanPropertyBinder but it is 
hard to intercept in order to implement this type of functionality.
This is not an easy problem to solve though as knowing constructor parameter 
order is much harder than just finding the right setter.

Other frameworks have different ways of solving this (Jackson uses Constructor 
annotations, MyBatis uses mappings).
While this is one possible solution, another slightly easier solution may be to 
allow intermediate builders to be used.
Defining a Builder interface (or annotation) with just a single build method 
would suffice.

That builder could have the setters required and handle the building 
automatically.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to