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