From c5324d9377786d58c6475ecce3547e7ed31df99e Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 17 Aug 2023 08:54:32 +0200 Subject: [PATCH] GH-100 - Polishing. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added missing license header. Simplify SimpleAssociation.equals(…). --- .../jmolecules/ddd/types/SimpleAssociation.kt | 4 +--- .../org/jmolecules/ddd/types/ValueObject.kt | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/kmolecules-ddd/src/main/kotlin/org/jmolecules/ddd/types/SimpleAssociation.kt b/kmolecules-ddd/src/main/kotlin/org/jmolecules/ddd/types/SimpleAssociation.kt index c1c7aa0..57f369d 100644 --- a/kmolecules-ddd/src/main/kotlin/org/jmolecules/ddd/types/SimpleAssociation.kt +++ b/kmolecules-ddd/src/main/kotlin/org/jmolecules/ddd/types/SimpleAssociation.kt @@ -38,9 +38,7 @@ class SimpleAssociation, ID : Identifier>(private val i other as SimpleAssociation<*, *> - if (id != other.id) return false - - return true + return id == other.id } override fun hashCode(): Int = id.hashCode() diff --git a/kmolecules-ddd/src/main/kotlin/org/jmolecules/ddd/types/ValueObject.kt b/kmolecules-ddd/src/main/kotlin/org/jmolecules/ddd/types/ValueObject.kt index 301288a..56cf5bb 100644 --- a/kmolecules-ddd/src/main/kotlin/org/jmolecules/ddd/types/ValueObject.kt +++ b/kmolecules-ddd/src/main/kotlin/org/jmolecules/ddd/types/ValueObject.kt @@ -1,8 +1,23 @@ +/* + * Copyright 2023 the original author or authors. + * + * 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 org.jmolecules.ddd.types /** - * Identifies a value object. Domain concepts that are modeled as value objects have no conceptual identity or - * lifecycle. Implementations should be immutable, operations on it are side-effect free. + * Identifies a value object. Domain concepts that are modeled as value objects have no conceptual identity or lifecycle. + * Implementations should be immutable, operations on it are side-effect free. * * Kotlin's counterpart of Java's [ValueObject](https://github.com/xmolecules/jmolecules/blob/main/jmolecules-ddd/src/main/java/org/jmolecules/ddd/types/ValueObject.java) *