src/main/java/org/intellimate/izou/sdk/frameworks/music/player/Progress.java
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();
        }
    }
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();
        }
    }
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
@param resourceModel the ResourceModel
@return the optional Progress
creates a Progress - object from the resourceModel