Remove empty constructor

pull/2/head
Hammy 3 years ago
parent 284be23d3a
commit fb0bfa2bff

@ -9,6 +9,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import me.goudham.domain.ClipboardContent; import me.goudham.domain.ClipboardContent;
import me.goudham.domain.GenericClipboardContent;
import me.goudham.domain.MyBufferedImage; import me.goudham.domain.MyBufferedImage;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -88,16 +89,16 @@ class ClipboardUtils {
* @return {@link GenericClipboardContent} containing clipboard contents * @return {@link GenericClipboardContent} containing clipboard contents
*/ */
GenericClipboardContent<?> getClipboardContents(Transferable contents) { GenericClipboardContent<?> getClipboardContents(Transferable contents) {
GenericClipboardContent<?> genericClipboardContent = new GenericClipboardContent<>(); GenericClipboardContent<?> genericClipboardContent = null;
try { try {
if (contents.isDataFlavorSupported(TEXT.getDataFlavor())) { if (contents.isDataFlavorSupported(TEXT.getDataFlavor())) {
genericClipboardContent.setOldContent(contents.getTransferData(TEXT.getDataFlavor())); genericClipboardContent = new GenericClipboardContent<>(contents.getTransferData(TEXT.getDataFlavor()));
} else if (contents.isDataFlavorSupported(IMAGE.getDataFlavor())) { } else if (contents.isDataFlavorSupported(IMAGE.getDataFlavor())) {
BufferedImage bufferedImage = convertToBufferedImage((Image) contents.getTransferData(IMAGE.getDataFlavor())); BufferedImage bufferedImage = convertToBufferedImage((Image) contents.getTransferData(IMAGE.getDataFlavor()));
genericClipboardContent.setOldContent(new MyBufferedImage(bufferedImage)); genericClipboardContent = new GenericClipboardContent<>(new MyBufferedImage(bufferedImage));
} else if (contents.isDataFlavorSupported(FILE.getDataFlavor())) { } else if (contents.isDataFlavorSupported(FILE.getDataFlavor())) {
genericClipboardContent.setOldContent(contents.getTransferData(FILE.getDataFlavor())); genericClipboardContent = new GenericClipboardContent<>(contents.getTransferData(FILE.getDataFlavor()));
} }
} catch (UnsupportedFlavorException | IOException exp) { } catch (UnsupportedFlavorException | IOException exp) {
logger.error("Exception Thrown When Retrieving Clipboard Contents", exp); logger.error("Exception Thrown When Retrieving Clipboard Contents", exp);

@ -9,6 +9,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import me.goudham.domain.ClipboardContent; import me.goudham.domain.ClipboardContent;
import me.goudham.domain.GenericClipboardContent;
import me.goudham.domain.MyBufferedImage; import me.goudham.domain.MyBufferedImage;
import static java.lang.Thread.sleep; import static java.lang.Thread.sleep;

@ -1,15 +1,11 @@
package me.goudham; package me.goudham.domain;
import java.util.Objects; import java.util.Objects;
class GenericClipboardContent<T> { public class GenericClipboardContent<T> {
private T oldContent; private T oldContent;
GenericClipboardContent() { public GenericClipboardContent(Object oldContent) {
}
GenericClipboardContent(Object oldContent) {
this.oldContent = (T) oldContent; this.oldContent = (T) oldContent;
} }

@ -10,6 +10,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.stream.Stream; import java.util.stream.Stream;
import me.goudham.domain.ClipboardContent; import me.goudham.domain.ClipboardContent;
import me.goudham.domain.GenericClipboardContent;
import me.goudham.domain.MyBufferedImage; import me.goudham.domain.MyBufferedImage;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

Loading…
Cancel
Save