Add in a few bits of Generics to avoid warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@895477 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-01-03 20:56:40 +00:00
parent 8a636423b2
commit 6b46bb007d
3 changed files with 16 additions and 15 deletions

View File

@ -47,7 +47,7 @@ public interface DirectoryEntry
* implementations of Entry. * implementations of Entry.
*/ */
public Iterator getEntries(); public Iterator<Entry> getEntries();
/** /**
* is this DirectoryEntry empty? * is this DirectoryEntry empty?

View File

@ -41,7 +41,7 @@ public class DirectoryNode
{ {
// Map of Entry instances, keyed by their names // Map of Entry instances, keyed by their names
private Map _entries; private Map<String,Entry> _entries;
// the POIFSFileSystem we belong to // the POIFSFileSystem we belong to
private POIFSFileSystem _filesystem; private POIFSFileSystem _filesystem;
@ -75,12 +75,12 @@ public class DirectoryNode
}); });
} }
_filesystem = filesystem; _filesystem = filesystem;
_entries = new HashMap(); _entries = new HashMap<String, Entry>();
Iterator iter = property.getChildren(); Iterator<Property> iter = property.getChildren();
while (iter.hasNext()) while (iter.hasNext())
{ {
Property child = ( Property ) iter.next(); Property child = iter.next();
Entry childNode = null; Entry childNode = null;
if (child.isDirectory()) if (child.isDirectory())
@ -215,7 +215,7 @@ public class DirectoryNode
* implementations of Entry. * implementations of Entry.
*/ */
public Iterator getEntries() public Iterator<Entry> getEntries()
{ {
return _entries.values().iterator(); return _entries.values().iterator();
} }
@ -263,7 +263,7 @@ public class DirectoryNode
if (name != null) if (name != null)
{ {
rval = ( Entry ) _entries.get(name); rval = _entries.get(name);
} }
if (rval == null) if (rval == null)
{ {
@ -416,8 +416,9 @@ public class DirectoryNode
List components = new ArrayList(); List components = new ArrayList();
components.add(getProperty()); components.add(getProperty());
SortedMap sortedEntries = new TreeMap(_entries); SortedMap<String,Entry> sortedEntries =
Iterator iter = sortedEntries.values().iterator(); new TreeMap<String,Entry>(_entries);
Iterator<Entry> iter = sortedEntries.values().iterator();
while (iter.hasNext()) while (iter.hasNext())
{ {

View File

@ -123,8 +123,8 @@ public class ExtractorFactory {
public static POIOLE2TextExtractor createExtractor(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException { public static POIOLE2TextExtractor createExtractor(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException {
// Look for certain entries in the stream, to figure it // Look for certain entries in the stream, to figure it
// out from // out from
for(Iterator entries = poifsDir.getEntries(); entries.hasNext(); ) { for(Iterator<Entry> entries = poifsDir.getEntries(); entries.hasNext(); ) {
Entry entry = (Entry)entries.next(); Entry entry = entries.next();
if(entry.getName().equals("Workbook")) { if(entry.getName().equals("Workbook")) {
return new ExcelExtractor(poifsDir, fs); return new ExcelExtractor(poifsDir, fs);
@ -160,9 +160,9 @@ public class ExtractorFactory {
if(ext instanceof ExcelExtractor) { if(ext instanceof ExcelExtractor) {
// These are in MBD... under the root // These are in MBD... under the root
Iterator it = fs.getRoot().getEntries(); Iterator<Entry> it = fs.getRoot().getEntries();
while(it.hasNext()) { while(it.hasNext()) {
Entry entry = (Entry)it.next(); Entry entry = it.next();
if(entry.getName().startsWith("MBD")) { if(entry.getName().startsWith("MBD")) {
dirs.add(entry); dirs.add(entry);
} }
@ -172,9 +172,9 @@ public class ExtractorFactory {
try { try {
DirectoryEntry op = (DirectoryEntry) DirectoryEntry op = (DirectoryEntry)
fs.getRoot().getEntry("ObjectPool"); fs.getRoot().getEntry("ObjectPool");
Iterator it = op.getEntries(); Iterator<Entry> it = op.getEntries();
while(it.hasNext()) { while(it.hasNext()) {
Entry entry = (Entry)it.next(); Entry entry = it.next();
if(entry.getName().startsWith("_")) { if(entry.getName().startsWith("_")) {
dirs.add(entry); dirs.add(entry);
} }