From c54967f016887b42fba1c3bdf1ad96a640977303 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 7 Jan 2024 19:22:57 +0900 Subject: [PATCH] WIP --- .../scanner/ScannerDataManagerStubFragment.java | 6 +++++- .../processor/impl/DocumentProcessorImpl.java | 3 +++ .../processor/module/DocumentProcessorModule.java | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerDataManagerStubFragment.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerDataManagerStubFragment.java index a075a18c..e361f9a1 100644 --- a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerDataManagerStubFragment.java +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerDataManagerStubFragment.java @@ -153,7 +153,11 @@ public class ScannerDataManagerStubFragment extends Fragment { Log.d("ScannerDataManagerStubFragment", "button_init_document_processor clicked"); Toast.makeText(getActivity(), "button_init_document_processor clicked", Toast.LENGTH_LONG).show(); // TODO-rca: ここでDocumentProcessorを初期化する -// DocumentProcessor documentProcessor = documentProcessorFactory.create(); + if (this.documentDetail == null) { + Toast.makeText(getActivity(), "documentDetail is null", Toast.LENGTH_LONG).show(); + return; + } + DocumentProcessor documentProcessor = documentProcessorFactory.create(this.documentDetail); }); } diff --git a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java index 9b39dd60..72758658 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java +++ b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java @@ -45,6 +45,9 @@ public class DocumentProcessorImpl implements DocumentProcessor{ @AssistedInject public DocumentProcessorImpl(@Assisted DocumentDetail documentDetail) { + if (documentDetail == null) { + throw new IllegalArgumentException("documentDetail must not be null"); + } this.documentDetail = documentDetail; } diff --git a/processor/src/main/java/one/nem/lacerta/processor/module/DocumentProcessorModule.java b/processor/src/main/java/one/nem/lacerta/processor/module/DocumentProcessorModule.java index 0f903a8e..b4456813 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/module/DocumentProcessorModule.java +++ b/processor/src/main/java/one/nem/lacerta/processor/module/DocumentProcessorModule.java @@ -1,4 +1,16 @@ package one.nem.lacerta.processor.module; +import dagger.assisted.Assisted; +import dagger.assisted.AssistedInject; +import one.nem.lacerta.model.document.DocumentDetail; + public class DocumentProcessorModule { + + private final DocumentDetail documentDetail; + + @AssistedInject + public DocumentProcessorModule(@Assisted DocumentDetail documentDetail) { + this.documentDetail = documentDetail; + } + }