You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by se...@apache.org on 2011/07/28 16:21:27 UTC
svn commit: r1151861 - in /poi/trunk/src/java/org/apache/poi/ddf:
EscherContainerRecord.java EscherOptRecord.java
Author: sergey
Date: Thu Jul 28 14:21:26 2011
New Revision: 1151861
URL: http://svn.apache.org/viewvc?rev=1151861&view=rev
Log:
child of ContainerRecord is not only SpContainer; use generics to preserve source-compatibility
Modified:
poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java
poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java
Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java?rev=1151861&r1=1151860&r2=1151861&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java Thu Jul 28 14:21:26 2011
@@ -254,12 +254,16 @@ public final class EscherContainerRecord
+ children.toString();
}
- public EscherSpRecord getChildById(short recordId) {
- Iterator<EscherRecord> iterator = _childRecords.iterator();
- while (iterator.hasNext()) {
- EscherRecord r = iterator.next();
- if (r.getRecordId() == recordId)
- return (EscherSpRecord) r;
+ public <T extends EscherRecord> T getChildById( short recordId )
+ {
+ for ( EscherRecord childRecord : _childRecords )
+ {
+ if ( childRecord.getRecordId() == recordId )
+ {
+ @SuppressWarnings( "unchecked" )
+ final T result = (T) childRecord;
+ return result;
+ }
}
return null;
}
Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java?rev=1151861&r1=1151860&r2=1151861&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java Thu Jul 28 14:21:26 2011
@@ -160,12 +160,16 @@ public class EscherOptRecord
} );
}
- public EscherProperty lookup(int propId)
+ public <T extends EscherProperty> T lookup( int propId )
{
- for (EscherProperty prop : properties)
+ for ( EscherProperty prop : properties )
{
- if (prop.getPropertyNumber() == propId)
- return prop;
+ if ( prop.getPropertyNumber() == propId )
+ {
+ @SuppressWarnings( "unchecked" )
+ final T result = (T) prop;
+ return result;
+ }
}
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org