New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error when using a ItemPresentationModel factory method for multiple lists #209

Closed
diedu89 opened this Issue Apr 15, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@diedu89

diedu89 commented Apr 15, 2015

I want to use a same factory method for two lists but i get a compile error that the factory method does not exist

Error:Execution failed for task ':app:compileDebugJava'.

org.robobinding.codegen.processor.PresentationModelErrors:
property errors:
The dataSet property 'list' expects an non-existing factory method 'createItem()'

@weicheng113

This comment has been minimized.

Member

weicheng113 commented Apr 16, 2015

Hi Diedu89,

Could you please make a smallest example to show the problem please? Thanks.

Cheng
2015-4-15 PM11:46于 "diedu89" notifications@github.com写道:

I want to use a same factory method for two lists but i get a compile
error that the factory method does not exist

Error:Execution failed for task ':app:compileDebugJava'.

org.robobinding.codegen.processor.PresentationModelErrors:
property errors:
The dataSet property 'list' expects an non-existing factory method
'createItem()'


Reply to this email directly or view it on GitHub
#209.

@diedu89

This comment has been minimized.

diedu89 commented Apr 16, 2015

@PresentationModel
public class MainPresentationModel{
    private PresentationModelChangeSupport changeSupport;
    List<Item> items = new ArrayList<>();
    List<Item> items2 = new ArrayList<>();

    @ItemPresentationModel(value = MyItemPresentationModel.class, factoryMethod = "createItem")
    public List<Item> getItems(){
        return items;
    }

    @ItemPresentationModel(value = MyItemPresentationModel.class, factoryMethod = "createItem")
    public List<Item> getItems2(){
        return items2;
    }

    public MyItemPresentationModel createItem(){
        return new MyItemPresentationModel(changeSupport);
    }

    public void addItem(){
        items.add(new Item());
        changeSupport.firePropertyChange("items");
    }

    @Override
    public PresentationModelChangeSupport getPresentationModelChangeSupport() {
        if(changeSupport==null) changeSupport = new PresentationModelChangeSupport(this);
        return changeSupport;
    }
}
@weicheng113

This comment has been minimized.

Member

weicheng113 commented Jul 24, 2015

@diedu89 , very good finding. Unit tests added and fixed. Thanks for your contributions.

@weicheng113 weicheng113 added this to the v0.8.10 milestone Aug 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment