From fad394bbab84ba94057e8c6f36b124883ce8dbc9 Mon Sep 17 00:00:00 2001 From: usbharu Date: Sun, 31 Mar 2024 09:37:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=83=93=E3=83=AB=E3=83=80=E3=83=BC?= =?UTF-8?q?=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../owl/producer/api/OwlProducerBuilder.kt | 22 +++++++++++++++++++ .../producer/api/OwlProducerBuilderConfig.kt | 21 ++++++++++++++++++ ...roducerFactory.kt => OwlProducerConfig.kt} | 5 +---- 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerBuilder.kt create mode 100644 producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerBuilderConfig.kt rename producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/{OwlProducerFactory.kt => OwlProducerConfig.kt} (87%) diff --git a/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerBuilder.kt b/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerBuilder.kt new file mode 100644 index 0000000..e49d5f3 --- /dev/null +++ b/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerBuilder.kt @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.owl.producer.api + +interface OwlProducerBuilder { + fun config(): T + fun apply(owlProducerConfig: T) +} \ No newline at end of file diff --git a/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerBuilderConfig.kt b/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerBuilderConfig.kt new file mode 100644 index 0000000..d4a5288 --- /dev/null +++ b/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerBuilderConfig.kt @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.owl.producer.api + +fun , C : OwlProducerConfig> OWL(owlProducerBuilder: T, config: C.() -> Unit) { + owlProducerBuilder.apply(owlProducerBuilder.config().apply { config() }) +} \ No newline at end of file diff --git a/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerFactory.kt b/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerConfig.kt similarity index 87% rename from producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerFactory.kt rename to producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerConfig.kt index 419689b..557547c 100644 --- a/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerFactory.kt +++ b/producer/api/src/main/kotlin/dev/usbharu/owl/producer/api/OwlProducerConfig.kt @@ -16,8 +16,5 @@ package dev.usbharu.owl.producer.api -object OwlProducerFactory { - fun createProducer():OwlProducer{ - TODO() - } +interface OwlProducerConfig { } \ No newline at end of file