From e21f832fe4d9003f86d138f14a2be7610e036526 Mon Sep 17 00:00:00 2001 From: Nathan Rauh Date: Tue, 7 Jan 2025 11:26:08 -0600 Subject: [PATCH] Issue #931 Use separate package for Restrictions Signed-off-by: Nathan Rauh --- .../main/java/jakarta/data/metamodel/Attribute.java | 6 +++--- .../jakarta/data/metamodel/SortableAttribute.java | 6 +++--- .../java/jakarta/data/metamodel/TextAttribute.java | 6 +++--- .../jakarta/data/{ => restrict}/BasicRestriction.java | 4 ++-- .../data/{ => restrict}/BasicRestrictionRecord.java | 4 ++-- .../data/{ => restrict}/CompositeRestriction.java | 4 ++-- .../{ => restrict}/CompositeRestrictionRecord.java | 4 ++-- .../java/jakarta/data/{ => restrict}/Operator.java | 4 ++-- .../java/jakarta/data/{ => restrict}/Restrict.java | 4 ++-- .../java/jakarta/data/{ => restrict}/Restriction.java | 4 ++-- .../jakarta/data/{ => restrict}/TextRestriction.java | 4 ++-- .../data/{ => restrict}/TextRestrictionRecord.java | 4 ++-- api/src/main/java/module-info.java | 1 + .../java/jakarta/data/metamodel/AttributeTest.java | 9 +++++---- .../jakarta/data/metamodel/SortableAttributeTest.java | 11 ++++++----- .../jakarta/data/metamodel/TextAttributeTest.java | 7 ++++--- .../{ => restrict}/BasicRestrictionRecordTest.java | 4 ++-- .../CompositeRestrictionRecordTest.java | 4 ++-- .../jakarta/data/{ => restrict}/RestrictTest.java | 4 ++-- .../{ => restrict}/TextRestrictionRecordTest.java | 6 +++--- 20 files changed, 52 insertions(+), 48 deletions(-) rename api/src/main/java/jakarta/data/{ => restrict}/BasicRestriction.java (89%) rename api/src/main/java/jakarta/data/{ => restrict}/BasicRestrictionRecord.java (92%) rename api/src/main/java/jakarta/data/{ => restrict}/CompositeRestriction.java (90%) rename api/src/main/java/jakarta/data/{ => restrict}/CompositeRestrictionRecord.java (93%) rename api/src/main/java/jakarta/data/{ => restrict}/Operator.java (93%) rename api/src/main/java/jakarta/data/{ => restrict}/Restrict.java (99%) rename api/src/main/java/jakarta/data/{ => restrict}/Restriction.java (87%) rename api/src/main/java/jakarta/data/{ => restrict}/TextRestriction.java (91%) rename api/src/main/java/jakarta/data/{ => restrict}/TextRestrictionRecord.java (94%) rename api/src/test/java/jakarta/data/{ => restrict}/BasicRestrictionRecordTest.java (98%) rename api/src/test/java/jakarta/data/{ => restrict}/CompositeRestrictionRecordTest.java (98%) rename api/src/test/java/jakarta/data/{ => restrict}/RestrictTest.java (98%) rename api/src/test/java/jakarta/data/{ => restrict}/TextRestrictionRecordTest.java (97%) diff --git a/api/src/main/java/jakarta/data/metamodel/Attribute.java b/api/src/main/java/jakarta/data/metamodel/Attribute.java index 147b73ba9..3637c0232 100644 --- a/api/src/main/java/jakarta/data/metamodel/Attribute.java +++ b/api/src/main/java/jakarta/data/metamodel/Attribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023,2024 Contributors to the Eclipse Foundation + * Copyright (c) 2023,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ import java.util.Set; -import jakarta.data.Restrict; -import jakarta.data.Restriction; +import jakarta.data.restrict.Restrict; +import jakarta.data.restrict.Restriction; /** * Represents an entity attribute in the {@link StaticMetamodel}. diff --git a/api/src/main/java/jakarta/data/metamodel/SortableAttribute.java b/api/src/main/java/jakarta/data/metamodel/SortableAttribute.java index 650164de9..b72b1b427 100644 --- a/api/src/main/java/jakarta/data/metamodel/SortableAttribute.java +++ b/api/src/main/java/jakarta/data/metamodel/SortableAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023,2024 Contributors to the Eclipse Foundation + * Copyright (c) 2023,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,9 @@ */ package jakarta.data.metamodel; -import jakarta.data.Restrict; -import jakarta.data.Restriction; import jakarta.data.Sort; +import jakarta.data.restrict.Restrict; +import jakarta.data.restrict.Restriction; /** * Represents a sortable entity attribute in the {@link StaticMetamodel}. diff --git a/api/src/main/java/jakarta/data/metamodel/TextAttribute.java b/api/src/main/java/jakarta/data/metamodel/TextAttribute.java index 9b0260256..f114a368e 100644 --- a/api/src/main/java/jakarta/data/metamodel/TextAttribute.java +++ b/api/src/main/java/jakarta/data/metamodel/TextAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023,2024 Contributors to the Eclipse Foundation + * Copyright (c) 2023,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,9 @@ */ package jakarta.data.metamodel; -import jakarta.data.Restrict; import jakarta.data.Sort; -import jakarta.data.TextRestriction; +import jakarta.data.restrict.Restrict; +import jakarta.data.restrict.TextRestriction; /** * Represents an textual entity attribute in the {@link StaticMetamodel}. diff --git a/api/src/main/java/jakarta/data/BasicRestriction.java b/api/src/main/java/jakarta/data/restrict/BasicRestriction.java similarity index 89% rename from api/src/main/java/jakarta/data/BasicRestriction.java rename to api/src/main/java/jakarta/data/restrict/BasicRestriction.java index d044da663..9d69909fb 100644 --- a/api/src/main/java/jakarta/data/BasicRestriction.java +++ b/api/src/main/java/jakarta/data/restrict/BasicRestriction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; public interface BasicRestriction extends Restriction { String attribute(); diff --git a/api/src/main/java/jakarta/data/BasicRestrictionRecord.java b/api/src/main/java/jakarta/data/restrict/BasicRestrictionRecord.java similarity index 92% rename from api/src/main/java/jakarta/data/BasicRestrictionRecord.java rename to api/src/main/java/jakarta/data/restrict/BasicRestrictionRecord.java index 4667f9cec..eafeefd49 100644 --- a/api/src/main/java/jakarta/data/BasicRestrictionRecord.java +++ b/api/src/main/java/jakarta/data/restrict/BasicRestrictionRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; // Internal implementation class. // The proper way for users to obtain instances is via diff --git a/api/src/main/java/jakarta/data/CompositeRestriction.java b/api/src/main/java/jakarta/data/restrict/CompositeRestriction.java similarity index 90% rename from api/src/main/java/jakarta/data/CompositeRestriction.java rename to api/src/main/java/jakarta/data/restrict/CompositeRestriction.java index 5c5a8ab6f..117b4a6dd 100644 --- a/api/src/main/java/jakarta/data/CompositeRestriction.java +++ b/api/src/main/java/jakarta/data/restrict/CompositeRestriction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; import java.util.List; diff --git a/api/src/main/java/jakarta/data/CompositeRestrictionRecord.java b/api/src/main/java/jakarta/data/restrict/CompositeRestrictionRecord.java similarity index 93% rename from api/src/main/java/jakarta/data/CompositeRestrictionRecord.java rename to api/src/main/java/jakarta/data/restrict/CompositeRestrictionRecord.java index 40b8d6124..a2aac2114 100644 --- a/api/src/main/java/jakarta/data/CompositeRestrictionRecord.java +++ b/api/src/main/java/jakarta/data/restrict/CompositeRestrictionRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; import java.util.List; diff --git a/api/src/main/java/jakarta/data/Operator.java b/api/src/main/java/jakarta/data/restrict/Operator.java similarity index 93% rename from api/src/main/java/jakarta/data/Operator.java rename to api/src/main/java/jakarta/data/restrict/Operator.java index 003357efe..b3e87c5af 100644 --- a/api/src/main/java/jakarta/data/Operator.java +++ b/api/src/main/java/jakarta/data/restrict/Operator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; public enum Operator { EQUAL, diff --git a/api/src/main/java/jakarta/data/Restrict.java b/api/src/main/java/jakarta/data/restrict/Restrict.java similarity index 99% rename from api/src/main/java/jakarta/data/Restrict.java rename to api/src/main/java/jakarta/data/restrict/Restrict.java index 9ba7dc492..7b0f346e0 100644 --- a/api/src/main/java/jakarta/data/Restrict.java +++ b/api/src/main/java/jakarta/data/restrict/Restrict.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; import java.util.List; import java.util.Objects; diff --git a/api/src/main/java/jakarta/data/Restriction.java b/api/src/main/java/jakarta/data/restrict/Restriction.java similarity index 87% rename from api/src/main/java/jakarta/data/Restriction.java rename to api/src/main/java/jakarta/data/restrict/Restriction.java index 91504c717..655605acb 100644 --- a/api/src/main/java/jakarta/data/Restriction.java +++ b/api/src/main/java/jakarta/data/restrict/Restriction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; public interface Restriction { Restriction negate(); diff --git a/api/src/main/java/jakarta/data/TextRestriction.java b/api/src/main/java/jakarta/data/restrict/TextRestriction.java similarity index 91% rename from api/src/main/java/jakarta/data/TextRestriction.java rename to api/src/main/java/jakarta/data/restrict/TextRestriction.java index d1a44fa84..2c0330df0 100644 --- a/api/src/main/java/jakarta/data/TextRestriction.java +++ b/api/src/main/java/jakarta/data/restrict/TextRestriction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; public interface TextRestriction extends BasicRestriction { TextRestriction ignoreCase(); diff --git a/api/src/main/java/jakarta/data/TextRestrictionRecord.java b/api/src/main/java/jakarta/data/restrict/TextRestrictionRecord.java similarity index 94% rename from api/src/main/java/jakarta/data/TextRestrictionRecord.java rename to api/src/main/java/jakarta/data/restrict/TextRestrictionRecord.java index e8e25cd26..74bd8f595 100644 --- a/api/src/main/java/jakarta/data/TextRestrictionRecord.java +++ b/api/src/main/java/jakarta/data/restrict/TextRestrictionRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; // Internal implementation class. // The proper way for users to obtain instances is via diff --git a/api/src/main/java/module-info.java b/api/src/main/java/module-info.java index f52e8862f..ba4f5c322 100644 --- a/api/src/main/java/module-info.java +++ b/api/src/main/java/module-info.java @@ -1072,6 +1072,7 @@ exports jakarta.data.page; exports jakarta.data.page.impl; exports jakarta.data.repository; + exports jakarta.data.restrict; exports jakarta.data.exceptions; opens jakarta.data.repository; exports jakarta.data.spi; diff --git a/api/src/test/java/jakarta/data/metamodel/AttributeTest.java b/api/src/test/java/jakarta/data/metamodel/AttributeTest.java index a109e1a9c..d178b3e32 100644 --- a/api/src/test/java/jakarta/data/metamodel/AttributeTest.java +++ b/api/src/test/java/jakarta/data/metamodel/AttributeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,13 @@ */ package jakarta.data.metamodel; -import jakarta.data.BasicRestriction; -import jakarta.data.Operator; -import jakarta.data.Restriction; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.Test; +import jakarta.data.restrict.BasicRestriction; +import jakarta.data.restrict.Operator; +import jakarta.data.restrict.Restriction; + import java.util.Set; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/api/src/test/java/jakarta/data/metamodel/SortableAttributeTest.java b/api/src/test/java/jakarta/data/metamodel/SortableAttributeTest.java index a28f4c2b6..2ae72c38c 100644 --- a/api/src/test/java/jakarta/data/metamodel/SortableAttributeTest.java +++ b/api/src/test/java/jakarta/data/metamodel/SortableAttributeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,12 @@ */ package jakarta.data.metamodel; -import jakarta.data.BasicRestriction; -import jakarta.data.CompositeRestriction; -import jakarta.data.Operator; -import jakarta.data.Restriction; import jakarta.data.Sort; +import jakarta.data.restrict.BasicRestriction; +import jakarta.data.restrict.CompositeRestriction; +import jakarta.data.restrict.Operator; +import jakarta.data.restrict.Restriction; + import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.Test; diff --git a/api/src/test/java/jakarta/data/metamodel/TextAttributeTest.java b/api/src/test/java/jakarta/data/metamodel/TextAttributeTest.java index 1c9b24ab1..715968a0f 100644 --- a/api/src/test/java/jakarta/data/metamodel/TextAttributeTest.java +++ b/api/src/test/java/jakarta/data/metamodel/TextAttributeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,10 @@ */ package jakarta.data.metamodel; -import jakarta.data.Operator; import jakarta.data.Sort; -import jakarta.data.TextRestriction; +import jakarta.data.restrict.Operator; +import jakarta.data.restrict.TextRestriction; + import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.Test; diff --git a/api/src/test/java/jakarta/data/BasicRestrictionRecordTest.java b/api/src/test/java/jakarta/data/restrict/BasicRestrictionRecordTest.java similarity index 98% rename from api/src/test/java/jakarta/data/BasicRestrictionRecordTest.java rename to api/src/test/java/jakarta/data/restrict/BasicRestrictionRecordTest.java index bd2e88bef..60cf53119 100644 --- a/api/src/test/java/jakarta/data/BasicRestrictionRecordTest.java +++ b/api/src/test/java/jakarta/data/restrict/BasicRestrictionRecordTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.Test; diff --git a/api/src/test/java/jakarta/data/CompositeRestrictionRecordTest.java b/api/src/test/java/jakarta/data/restrict/CompositeRestrictionRecordTest.java similarity index 98% rename from api/src/test/java/jakarta/data/CompositeRestrictionRecordTest.java rename to api/src/test/java/jakarta/data/restrict/CompositeRestrictionRecordTest.java index 67e3f9df4..cd2399b51 100644 --- a/api/src/test/java/jakarta/data/CompositeRestrictionRecordTest.java +++ b/api/src/test/java/jakarta/data/restrict/CompositeRestrictionRecordTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; import org.assertj.core.api.SoftAssertions; diff --git a/api/src/test/java/jakarta/data/RestrictTest.java b/api/src/test/java/jakarta/data/restrict/RestrictTest.java similarity index 98% rename from api/src/test/java/jakarta/data/RestrictTest.java rename to api/src/test/java/jakarta/data/restrict/RestrictTest.java index 8d458fc0f..ed243c2d8 100644 --- a/api/src/test/java/jakarta/data/RestrictTest.java +++ b/api/src/test/java/jakarta/data/restrict/RestrictTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.Test; diff --git a/api/src/test/java/jakarta/data/TextRestrictionRecordTest.java b/api/src/test/java/jakarta/data/restrict/TextRestrictionRecordTest.java similarity index 97% rename from api/src/test/java/jakarta/data/TextRestrictionRecordTest.java rename to api/src/test/java/jakarta/data/restrict/TextRestrictionRecordTest.java index a0d799af9..05bd22ee5 100644 --- a/api/src/test/java/jakarta/data/TextRestrictionRecordTest.java +++ b/api/src/test/java/jakarta/data/restrict/TextRestrictionRecordTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,12 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package jakarta.data; +package jakarta.data.restrict; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.Test; -import jakarta.data.BasicRestrictionRecordTest.Book; +import jakarta.data.restrict.BasicRestrictionRecordTest.Book; import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;