Fix a few generics warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@898748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-01-13 13:42:15 +00:00
parent 545f2e1119
commit 1362cf6ba7
3 changed files with 22 additions and 21 deletions

View File

@ -46,18 +46,18 @@ public abstract class AbstractEscherHolderRecord extends Record {
} }
} }
private List escherRecords; private List<EscherRecord> escherRecords;
private byte[] rawData; private byte[] rawData;
public AbstractEscherHolderRecord() public AbstractEscherHolderRecord()
{ {
escherRecords = new ArrayList(); escherRecords = new ArrayList<EscherRecord>();
} }
public AbstractEscherHolderRecord(RecordInputStream in) public AbstractEscherHolderRecord(RecordInputStream in)
{ {
escherRecords = new ArrayList(); escherRecords = new ArrayList<EscherRecord>();
if (! DESERIALISE ) if (! DESERIALISE )
{ {
rawData = in.readRemainder(); rawData = in.readRemainder();
@ -93,9 +93,9 @@ public abstract class AbstractEscherHolderRecord extends Record {
buffer.append('[' + getRecordName() + ']' + nl); buffer.append('[' + getRecordName() + ']' + nl);
if (escherRecords.size() == 0) if (escherRecords.size() == 0)
buffer.append("No Escher Records Decoded" + nl); buffer.append("No Escher Records Decoded" + nl);
for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) for ( Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext(); )
{ {
EscherRecord r = (EscherRecord) iterator.next(); EscherRecord r = iterator.next();
buffer.append(r.toString()); buffer.append(r.toString());
} }
buffer.append("[/" + getRecordName() + ']' + nl); buffer.append("[/" + getRecordName() + ']' + nl);
@ -120,9 +120,9 @@ public abstract class AbstractEscherHolderRecord extends Record {
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
int pos = offset + 4; int pos = offset + 4;
for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) for ( Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext(); )
{ {
EscherRecord r = (EscherRecord) iterator.next(); EscherRecord r = iterator.next();
pos += r.serialize( pos, data, new NullEscherSerializationListener() ); pos += r.serialize( pos, data, new NullEscherSerializationListener() );
} }
return getRecordSize(); return getRecordSize();
@ -133,9 +133,9 @@ public abstract class AbstractEscherHolderRecord extends Record {
return rawData.length; return rawData.length;
} }
int size = 0; int size = 0;
for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) for ( Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext(); )
{ {
EscherRecord r = (EscherRecord) iterator.next(); EscherRecord r = iterator.next();
size += r.getRecordSize(); size += r.getRecordSize();
} }
return size; return size;
@ -160,7 +160,7 @@ public abstract class AbstractEscherHolderRecord extends Record {
return escherRecords.add( element ); return escherRecords.add( element );
} }
public List getEscherRecords() public List<EscherRecord> getEscherRecords()
{ {
return escherRecords; return escherRecords;
} }
@ -176,8 +176,8 @@ public abstract class AbstractEscherHolderRecord extends Record {
* then return that. * then return that.
*/ */
public EscherContainerRecord getEscherContainer() { public EscherContainerRecord getEscherContainer() {
for(Iterator it = escherRecords.iterator(); it.hasNext();) { for(Iterator<EscherRecord> it = escherRecords.iterator(); it.hasNext();) {
Object er = it.next(); EscherRecord er = it.next();
if(er instanceof EscherContainerRecord) { if(er instanceof EscherContainerRecord) {
return (EscherContainerRecord)er; return (EscherContainerRecord)er;
} }

View File

@ -67,6 +67,7 @@ import org.apache.poi.hssf.util.CellReference;
import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.CreationHelper; import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
import org.apache.poi.ss.formula.FormulaType; import org.apache.poi.ss.formula.FormulaType;
import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogFactory;
@ -1568,18 +1569,18 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
* *
* @return the list of pictures (a list of {@link HSSFPictureData} objects.) * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
*/ */
public List<HSSFPictureData> getAllPictures() public List<PictureData> getAllPictures()
{ {
// The drawing group record always exists at the top level, so we won't need to do this recursively. // The drawing group record always exists at the top level, so we won't need to do this recursively.
List<HSSFPictureData> pictures = new ArrayList<HSSFPictureData>(); List<PictureData> pictures = new ArrayList<PictureData>();
Iterator recordIter = workbook.getRecords().iterator(); Iterator<Record> recordIter = workbook.getRecords().iterator();
while (recordIter.hasNext()) while (recordIter.hasNext())
{ {
Object obj = recordIter.next(); Record r = recordIter.next();
if (obj instanceof AbstractEscherHolderRecord) if (r instanceof AbstractEscherHolderRecord)
{ {
((AbstractEscherHolderRecord) obj).decode(); ((AbstractEscherHolderRecord) r).decode();
List escherRecords = ((AbstractEscherHolderRecord) obj).getEscherRecords(); List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
searchForPictures(escherRecords, pictures); searchForPictures(escherRecords, pictures);
} }
} }
@ -1592,7 +1593,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
* @param escherRecords the escher records. * @param escherRecords the escher records.
* @param pictures the list to populate with the pictures. * @param pictures the list to populate with the pictures.
*/ */
private void searchForPictures(List escherRecords, List<HSSFPictureData> pictures) private void searchForPictures(List escherRecords, List<PictureData> pictures)
{ {
Iterator recordIter = escherRecords.iterator(); Iterator recordIter = escherRecords.iterator();
while (recordIter.hasNext()) while (recordIter.hasNext())

View File

@ -405,7 +405,7 @@ public interface Workbook {
* *
* @return the list of pictures (a list of {@link PictureData} objects.) * @return the list of pictures (a list of {@link PictureData} objects.)
*/ */
List getAllPictures(); List<PictureData> getAllPictures();
/** /**
* Returns an object that handles instantiating concrete * Returns an object that handles instantiating concrete