From 420a4701c0df530489ee59ca6e968ca54319fd99 Mon Sep 17 00:00:00 2001 From: Sandro Zbinden Date: Fri, 28 Jan 2022 11:19:14 +0100 Subject: [PATCH 1/2] feat: add BusinessException annotation to signal attempts to invalidly change business invariants --- .../ddd/annotation/BusinessException.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 jmolecules-ddd/src/main/java/org/jmolecules/ddd/annotation/BusinessException.java diff --git a/jmolecules-ddd/src/main/java/org/jmolecules/ddd/annotation/BusinessException.java b/jmolecules-ddd/src/main/java/org/jmolecules/ddd/annotation/BusinessException.java new file mode 100644 index 0000000..703489d --- /dev/null +++ b/jmolecules-ddd/src/main/java/org/jmolecules/ddd/annotation/BusinessException.java @@ -0,0 +1,17 @@ +package org.jmolecules.ddd.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Represents a business exception. Business exceptions signal attempts to invalidly change business invariants. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Documented +public @interface BusinessException { +} + From a11272dc8496fc8dae229c4ed1e3b4187f62e6f5 Mon Sep 17 00:00:00 2001 From: Sandro Zbinden Date: Fri, 28 Jan 2022 11:44:04 +0100 Subject: [PATCH 2/2] chore: add license to BusinessException --- .../ddd/annotation/BusinessException.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/jmolecules-ddd/src/main/java/org/jmolecules/ddd/annotation/BusinessException.java b/jmolecules-ddd/src/main/java/org/jmolecules/ddd/annotation/BusinessException.java index 703489d..2055a9b 100644 --- a/jmolecules-ddd/src/main/java/org/jmolecules/ddd/annotation/BusinessException.java +++ b/jmolecules-ddd/src/main/java/org/jmolecules/ddd/annotation/BusinessException.java @@ -1,3 +1,18 @@ +/* + * Copyright 2020 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.annotation; import java.lang.annotation.Documented;