-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathNonnullPropertyRules.kt
More file actions
74 lines (62 loc) · 3.46 KB
/
NonnullPropertyRules.kt
File metadata and controls
74 lines (62 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.ecwid.apiclient.v3.rule
import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO
import com.ecwid.apiclient.v3.dto.coupon.request.UpdatedCoupon
import com.ecwid.apiclient.v3.dto.customergroup.request.UpdatedCustomerGroup
import com.ecwid.apiclient.v3.dto.product.request.UpdatedProduct
import com.ecwid.apiclient.v3.dto.profile.request.UpdatedStoreProfile
import com.ecwid.apiclient.v3.dto.profile.result.FetchedStoreProfile
import com.ecwid.apiclient.v3.dto.storage.request.UpdatedStorageData
import com.ecwid.apiclient.v3.dto.variation.request.UpdatedVariation
import com.ecwid.apiclient.v3.rule.NonnullPropertyRule.AllowNonnull
import com.ecwid.apiclient.v3.rule.NonnullPropertyRule.IgnoreNonnull
import kotlin.reflect.KProperty1
val nonnullPropertyRules: List<NonnullPropertyRule<*, *>> = listOf(
AllowNonnull(ApiUpdatedDTO.ModifyKind.ReadWrite::fetchedDTOClass),
AllowNonnull(UpdatedProduct.CustomPriceTier::value),
AllowNonnull(UpdatedStorageData::key),
AllowNonnull(UpdatedStorageData::value),
IgnoreNonnull(UpdatedCoupon::code),
IgnoreNonnull(UpdatedCoupon::name),
IgnoreNonnull(UpdatedCustomerGroup::name),
IgnoreNonnull(UpdatedProduct.ProductImage::id),
IgnoreNonnull(UpdatedProduct.ProductImage::orderBy),
IgnoreNonnull(UpdatedProduct.ProductOption.CheckboxOption::choices),
IgnoreNonnull(UpdatedProduct.ProductOption.CheckboxOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.DateOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.FilesOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.RadioOption::choices),
IgnoreNonnull(UpdatedProduct.ProductOption.RadioOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.SelectOption::choices),
IgnoreNonnull(UpdatedProduct.ProductOption.SelectOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.SizeOption::choices),
IgnoreNonnull(UpdatedProduct.ProductOption.SizeOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.SwatchesOption::choices),
IgnoreNonnull(UpdatedProduct.ProductOption.SwatchesOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.SwatchesOption::useImageAsSwatchSelector),
IgnoreNonnull(UpdatedProduct.ProductOption.TextAreaOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.TextFieldOption::name),
IgnoreNonnull(UpdatedProduct.ProductOptionChoice::text),
IgnoreNonnull(UpdatedProduct.RecurringChargeSettings::recurringInterval),
IgnoreNonnull(UpdatedProduct.RecurringChargeSettings::recurringIntervalCount),
IgnoreNonnull(UpdatedProduct.WholesalePrice::price),
IgnoreNonnull(UpdatedProduct.WholesalePrice::quantity),
IgnoreNonnull(UpdatedVariation.WholesalePrice::price),
IgnoreNonnull(UpdatedVariation.WholesalePrice::quantity),
AllowNonnull(UpdatedStoreProfile.ProductFilterItem::enabled),
AllowNonnull(UpdatedStoreProfile.ProductFilterItem::type),
AllowNonnull(UpdatedStoreProfile.ProductFiltersSettings::enabledInStorefront),
AllowNonnull(UpdatedStoreProfile.ProductFiltersSettings::filterSections),
AllowNonnull(UpdatedVariation.RecurringChargeSettings::recurringInterval),
AllowNonnull(UpdatedVariation.RecurringChargeSettings::recurringIntervalCount),
AllowNonnull(FetchedStoreProfile.Settings::highlightCompositeProductsOnStorefront),
)
sealed class NonnullPropertyRule<T, R>(
val property: KProperty1<T, R>
) {
class AllowNonnull<T, R> internal constructor(
property: KProperty1<T, R>
) : NonnullPropertyRule<T, R>(property)
class IgnoreNonnull<T, R> internal constructor(
property: KProperty1<T, R>
) : NonnullPropertyRule<T, R>(property)
}