From 759e9a163d707eba4e3ae10410814270cd2b209c Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Wed, 11 Feb 2015 15:12:10 +0100 Subject: [PATCH] Minor refactoring - changed class name and added immutability on the headers set --- .../accurest/dsl/internal/CustomizableProperty.groovy | 4 ++-- .../io/coderate/accurest/dsl/internal/Headers.groovy | 3 +-- .../accurest/dsl/internal/WithValuePattern.groovy | 10 +++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/CustomizableProperty.groovy b/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/CustomizableProperty.groovy index 592fff82a0..fc6dfcb503 100644 --- a/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/CustomizableProperty.groovy +++ b/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/CustomizableProperty.groovy @@ -26,8 +26,8 @@ class CustomizableProperty { class StringCustomizableProperty extends CustomizableProperty { } -class NoOpCustomizableProperty extends CustomizableProperty { - NoOpCustomizableProperty(T value) { +class SingleTypeCustomizableProperty extends CustomizableProperty { + SingleTypeCustomizableProperty(T value) { client(value) server(value) } diff --git a/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/Headers.groovy b/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/Headers.groovy index 3ab38d42ec..ca7e87e7cb 100644 --- a/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/Headers.groovy +++ b/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/Headers.groovy @@ -11,7 +11,6 @@ class Headers { } Set> entries() { - //TODO: Make it immutable - return headers.entrySet() + return Collections.unmodifiableSet(headers.entrySet()) } } diff --git a/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/WithValuePattern.groovy b/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/WithValuePattern.groovy index 5f92b4f27f..9e44935cfa 100644 --- a/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/WithValuePattern.groovy +++ b/accurest-core/src/main/groovy/io/coderate/accurest/dsl/internal/WithValuePattern.groovy @@ -4,11 +4,11 @@ import static io.coderate.accurest.dsl.internal.DelegateHelper.delegateToClosure class WithValuePattern { - NoOpCustomizableProperty equalToJson - NoOpCustomizableProperty equalToXml + SingleTypeCustomizableProperty equalToJson + SingleTypeCustomizableProperty equalToXml StringCustomizableProperty matchesXPath - NoOpCustomizableProperty jsonCompareMode - NoOpCustomizableProperty equalTo + SingleTypeCustomizableProperty jsonCompareMode + SingleTypeCustomizableProperty equalTo StringCustomizableProperty contains StringCustomizableProperty matches StringCustomizableProperty doesNotMatch @@ -20,7 +20,7 @@ class WithValuePattern { // } // void equalTo(String equalTo) { - this.equalTo = new NoOpCustomizableProperty(equalTo) + this.equalTo = new SingleTypeCustomizableProperty(equalTo) } // void equalToXml(String equalToXml) {