@@ -41,7 +41,7 @@ public abstract class PolarisConfiguration<T> {
41
41
42
42
public final String key ;
43
43
public final String description ;
44
- public final Optional <String > deprecatedKey ;
44
+ public final Optional <String > legacyKey ;
45
45
public final T defaultValue ;
46
46
private final Optional <String > catalogConfigImpl ;
47
47
private final Optional <String > catalogConfigUnsafeImpl ;
@@ -57,20 +57,19 @@ public abstract class PolarisConfiguration<T> {
57
57
private static void registerConfiguration (PolarisConfiguration <?> configuration ) {
58
58
for (PolarisConfiguration <?> existingConfiguration : allConfigurations ) {
59
59
if (existingConfiguration .key .equals (configuration .key )
60
- || (configuration .deprecatedKey .isPresent ()
61
- && existingConfiguration .key .equals (configuration .deprecatedKey .get ()))) {
60
+ || (configuration .legacyKey .isPresent ()
61
+ && existingConfiguration .key .equals (configuration .legacyKey .get ()))) {
62
62
throw new IllegalArgumentException (
63
63
String .format ("Config '%s' is already in use" , existingConfiguration .key ));
64
- } else if (existingConfiguration .deprecatedKey .isPresent ()
65
- && (configuration .key .equals (existingConfiguration .deprecatedKey .get ())
66
- || (configuration .deprecatedKey .isPresent ()
64
+ } else if (existingConfiguration .legacyKey .isPresent ()
65
+ && (configuration .key .equals (existingConfiguration .legacyKey .get ())
66
+ || (configuration .legacyKey .isPresent ()
67
67
&& configuration
68
- .deprecatedKey
68
+ .legacyKey
69
69
.get ()
70
- .equals (existingConfiguration .deprecatedKey .get ())))) {
70
+ .equals (existingConfiguration .legacyKey .get ())))) {
71
71
throw new IllegalArgumentException (
72
- String .format (
73
- "Config '%s' is already in use" , existingConfiguration .deprecatedKey .get ()));
72
+ String .format ("Config '%s' is already in use" , existingConfiguration .legacyKey .get ()));
74
73
} else {
75
74
var configs =
76
75
Stream .of (
@@ -99,26 +98,26 @@ public static List<PolarisConfiguration<?>> getAllConfigurations() {
99
98
@ SuppressWarnings ("unchecked" )
100
99
protected PolarisConfiguration (
101
100
String key ,
102
- Optional <String > deprecatedKey ,
101
+ Optional <String > legacyKey ,
103
102
String description ,
104
103
T defaultValue ,
105
104
Optional <String > catalogConfig ,
106
105
Optional <String > catalogConfigUnsafe ) {
107
106
this .key = key ;
108
- this .deprecatedKey = deprecatedKey ;
107
+ this .legacyKey = legacyKey ;
109
108
this .description = description ;
110
109
this .defaultValue = defaultValue ;
111
110
this .catalogConfigImpl = catalogConfig ;
112
111
this .catalogConfigUnsafeImpl = catalogConfigUnsafe ;
113
112
this .typ = (Class <T >) defaultValue .getClass ();
114
113
}
115
114
116
- public boolean hasDeprecatedKey () {
117
- return deprecatedKey .isPresent ();
115
+ public boolean hasLegacyKey () {
116
+ return legacyKey .isPresent ();
118
117
}
119
118
120
- public String deprecatedKey () {
121
- return deprecatedKey .orElseThrow (
119
+ public String legacyKey () {
120
+ return legacyKey .orElseThrow (
122
121
() ->
123
122
new IllegalStateException (
124
123
"Attempted to read a deprecated key from a configuration that doesn't have one." ));
@@ -152,7 +151,7 @@ T cast(Object value) {
152
151
153
152
public static class Builder <T > {
154
153
private String key ;
155
- private Optional <String > deprecatedKey = Optional .empty ();
154
+ private Optional <String > legacyKey = Optional .empty ();
156
155
private String description ;
157
156
private T defaultValue ;
158
157
private Optional <String > catalogConfig = Optional .empty ();
@@ -163,8 +162,8 @@ public Builder<T> key(String key) {
163
162
return this ;
164
163
}
165
164
166
- public Builder <T > deprecatedKey (String deprecatedKey ) {
167
- this .deprecatedKey = Optional .of (deprecatedKey );
165
+ public Builder <T > legacyKey (String legacyKey ) {
166
+ this .legacyKey = Optional .of (legacyKey );
168
167
return this ;
169
168
}
170
169
@@ -222,7 +221,7 @@ public FeatureConfiguration<T> buildFeatureConfiguration() {
222
221
validateOrThrow ();
223
222
FeatureConfiguration <T > config =
224
223
new FeatureConfiguration <>(
225
- key , deprecatedKey , description , defaultValue , catalogConfig , catalogConfigUnsafe );
224
+ key , legacyKey , description , defaultValue , catalogConfig , catalogConfigUnsafe );
226
225
PolarisConfiguration .registerConfiguration (config );
227
226
return config ;
228
227
}
@@ -235,7 +234,7 @@ public BehaviorChangeConfiguration<T> buildBehaviorChangeConfiguration() {
235
234
}
236
235
BehaviorChangeConfiguration <T > config =
237
236
new BehaviorChangeConfiguration <>(
238
- key , deprecatedKey , description , defaultValue , catalogConfig , catalogConfigUnsafe );
237
+ key , legacyKey , description , defaultValue , catalogConfig , catalogConfigUnsafe );
239
238
PolarisConfiguration .registerConfiguration (config );
240
239
return config ;
241
240
}
0 commit comments