001package co.codewizards.cloudstore.local.dto;
002
003import static co.codewizards.cloudstore.core.objectfactory.ObjectFactoryUtil.*;
004import static co.codewizards.cloudstore.core.util.AssertUtil.*;
005import co.codewizards.cloudstore.core.dto.FileChunkDto;
006import co.codewizards.cloudstore.local.persistence.FileChunk;
007
008public class FileChunkDtoConverter {
009
010        public static FileChunkDtoConverter create() {
011                return createObject(FileChunkDtoConverter.class);
012        }
013
014        protected FileChunkDtoConverter() { }
015
016        public FileChunkDto toFileChunkDto(final FileChunk fileChunk) {
017                assertNotNull(fileChunk, "fileChunk");
018                final FileChunkDto fileChunkDto = createObject(FileChunkDto.class);
019                fileChunkDto.setOffset(fileChunk.getOffset());
020                fileChunkDto.setLength(fileChunk.getLength());
021                fileChunkDto.setSha1(fileChunk.getSha1());
022                return fileChunkDto;
023        }
024}