Generics
I'm new to generics and wondering what I'm doing makes any sense at all.
publicclass ACHFile<Bextends ACHBatch>{
private List<B> batches =new ArrayList<B>();
public List<B> getBatches(){return batches;}
}
publicclass ACHBatch<Eextends ACHEntry>{
private List<E> entries;
public ACHBatch(){}
public List<E> getEntries(){return entries;}
publicvoid setEntries(List<E> entries){ this.entries = entries;}
}
publicclass ACHEntry{}
publicclass CTXBatchextends ACHBatch{
public CTXBatch(){ setEntries(new ArrayList<CTXEntry>);}
}
publicclass CTXEntryextends ACHEntry{}
So, an instance of ACHFile will contain a collection of some subclass of ACHBatch:
ACHFile<CTXBatch> f =new ACHFile<CTXBatch>();
CTXBatch knows what kind of entries it's supposed to contain:
setEntries(new ArrayList<CTXEntry>);
But I get this warning on the above statement:
Type safety: The field entries from the raw type ACHBatch is assigned a value of type ArrayList<E>. References to generic type ACHBatch<E> should be parameterized.
This makes me think I'm probably taking a bad approach to this problem. Am I missing something obvious here, or should I be rethinking this whole approach?
Thanks...

