浏览代码

DocumentImage converters

apg 3 周之前
父节点
当前提交
96ff2402de

+ 22 - 0
src/main/java/scot/carricksoftware/grants/converters/images/documentimage/DocumentImageCommandConverter.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 11/03/2025, 18:55. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.converters.images.documentimage;
+
+
+import jakarta.validation.constraints.NotNull;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Component;
+import scot.carricksoftware.grants.commands.images.DocumentImageCommand;
+import scot.carricksoftware.grants.domains.images.DocumentImage;
+
+@Component
+public interface DocumentImageCommandConverter extends Converter<DocumentImageCommand, DocumentImage> {
+
+    @Override
+    DocumentImage convert(@SuppressWarnings("NullableProblems") @NotNull DocumentImageCommand source);
+
+
+}

+ 32 - 0
src/main/java/scot/carricksoftware/grants/converters/images/documentimage/DocumentImageCommandConverterImpl.java

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 11/03/2025, 18:55. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.converters.images.documentimage;
+
+
+import jakarta.validation.constraints.NotNull;
+import org.springframework.stereotype.Component;
+import scot.carricksoftware.grants.commands.images.DocumentImageCommand;
+import scot.carricksoftware.grants.domains.images.DocumentImage;
+
+@Component
+public class DocumentImageCommandConverterImpl implements DocumentImageCommandConverter {
+
+    @SuppressWarnings("DuplicatedCode")
+    @Override
+    public DocumentImage convert(@NotNull DocumentImageCommand source) {
+        DocumentImage target = new DocumentImage();
+        target.setId(source.getId());
+        target.setImage(source.getImage());
+        target.setLevel(source.getLevel());
+        target.setOrder(source.getOrder());
+        target.setCaption(source.getCaption());
+        target.setHeight(source.getHeight());
+        target.setWidth(source.getWidth());
+        return target;
+    }
+
+
+}

+ 19 - 0
src/main/java/scot/carricksoftware/grants/converters/images/documentimage/DocumentImageConverter.java

@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 11/03/2025, 18:55. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.converters.images.documentimage;
+
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Component;
+import scot.carricksoftware.grants.commands.images.DocumentImageCommand;
+import scot.carricksoftware.grants.domains.images.DocumentImage;
+
+@SuppressWarnings("unused")
+@Component
+public interface DocumentImageConverter extends Converter<DocumentImage, DocumentImageCommand> {
+
+    @SuppressWarnings("NullableProblems")
+    DocumentImageCommand convert(DocumentImage source);
+}

+ 34 - 0
src/main/java/scot/carricksoftware/grants/converters/images/documentimage/DocumentImageConverterImpl.java

@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 11/03/2025, 18:55. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.converters.images.documentimage;
+
+
+import org.springframework.stereotype.Component;
+import scot.carricksoftware.grants.commands.images.DocumentImageCommand;
+import scot.carricksoftware.grants.commands.images.DocumentImageCommandImpl;
+import scot.carricksoftware.grants.domains.images.DocumentImage;
+
+
+@Component
+public class DocumentImageConverterImpl implements DocumentImageConverter {
+
+    @SuppressWarnings("DuplicatedCode")
+    @Override
+    public DocumentImageCommand convert(DocumentImage source) {
+        DocumentImageCommand target = new DocumentImageCommandImpl();
+        target.setId(source.getId());
+        target.setOrder(source.getOrder());
+        target.setCaption(source.getCaption());
+        target.setHeight(source.getHeight());
+        target.setWidth(source.getWidth());
+        target.setImage(source.getImage());
+        target.setLevel(source.getLevel());
+
+        return target;
+    }
+}
+
+