public static Optional < Progress > importResource ( ResourceModel resourceModel ) { Object resource = resourceModel . getResource ( ) ; try { //noinspection unchecked HashMap < String , Long > data = ( HashMap < String , Long > ) resource ; long length = data . get ( lengthDescriptor ) ; long knownPosition = data . get ( knownPositionDescriptor ) ; long knownTimestamp = data . get ( knownMillisTimeStampDescriptor ) ; return Optional . of ( new Progress ( length , knownPosition , knownTimestamp ) ) ; } catch ( Exception e ) { return Optional . empty ( ) ; } }
creates a Progress - object from the resourceModel