Results 1 to 2 of 2

Thread: Overloading method "add" of Chunk

  1. #1
    Join Date
    Jun 2011
    Posts
    19

    Default Overloading method "add" of Chunk

    Hello

    I ran into an issue with the processing of collections in a CompositeItemProcessor, what bugs me is that I made a smoke test some time ago where I return a list of items which properly got written by a FlatFileItemWriter.

    I need to revisit that smoke test though to be sure.

    The issue I ran into is that if I return a list of items by the last processor the write method of the ItemWriter will not decompose the list since the list I returned in my processor is wrapped in another list by the SimpleChunkProcessor by the method:

    Code:
    70 
    71 	public void add(W item) {
    72 		items.add(item);
    73 	}
    I cannot foresee the side effects yet but I was wondering if it makes sense to overload the add method with;

    Code:
    public void add(Collection<? extends W> items){
                items.addAll(items);
    }
    For the time being I will extend FlatFileItemWriter and override the write method and decomposing the outer list if I get nested list structures as the output of my processor chain.

    Any comments appreciated.

    Best regards

  2. #2
    Join Date
    Jun 2011
    Posts
    19

    Default

    Hello

    I am not sure why there was no response, I implemented my own workaround which dissasembles List of List structures if occured and calls the reader with the unpacked lists.
    But I am still wondering why this is not covered for a processor, I am surely missing something but would be happy if someone can shed some light on it.

    Thanks
    Tarik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •