+ 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;
}
} );
}
- 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;
}