2020import com .fasterxml .jackson .databind .ObjectMapper ;
2121import com .fasterxml .jackson .databind .PropertyNamingStrategies ;
2222import com .fasterxml .jackson .datatype .jdk8 .Jdk8Module ;
23+ import com .google .common .collect .ImmutableMap ;
2324import com .hubspot .jinjava .el .JinjavaInterpreterResolver ;
2425import com .hubspot .jinjava .el .JinjavaObjectUnwrapper ;
2526import com .hubspot .jinjava .el .JinjavaProcessors ;
5354
5455@ Value .Immutable (singleton = true )
5556@ JinjavaImmutableStyle .WithStyle
56- public interface JinjavaConfig {
57+ public class JinjavaConfig {
58+ public JinjavaConfig () {}
5759 @ Value .Default
58- default Charset getCharset () {
60+ public Charset getCharset () {
5961 return StandardCharsets .UTF_8 ;
6062 }
6163
6264 @ Value .Default
63- default Locale getLocale () {
65+ public Locale getLocale () {
6466 return Locale .ENGLISH ;
6567 }
6668
6769 @ Value .Default
68- default ZoneId getTimeZone () {
70+ public ZoneId getTimeZone () {
6971 return ZoneOffset .UTC ;
7072 }
7173
7274 @ Value .Default
73- default int getMaxRenderDepth () {
75+ public int getMaxRenderDepth () {
7476 return 10 ;
7577 }
7678
7779 @ Value .Default
78- default long getMaxOutputSize () {
80+ public long getMaxOutputSize () {
7981 return 0 ;
8082 }
8183
8284 @ Value .Default
83- default boolean isTrimBlocks () {
85+ public boolean isTrimBlocks () {
8486 return false ;
8587 }
8688
8789 @ Value .Default
88- default boolean isLstripBlocks () {
90+ public boolean isLstripBlocks () {
8991 return false ;
9092 }
9193
9294 @ Value .Default
93- default boolean isEnableRecursiveMacroCalls () {
95+ public boolean isEnableRecursiveMacroCalls () {
9496 return false ;
9597 }
9698
9799 @ Value .Default
98- default int getMaxMacroRecursionDepth () {
100+ public int getMaxMacroRecursionDepth () {
99101 return 0 ;
100102 }
101103
102- Map <Library , Set <String >> getDisabled ();
104+ public Map <Library , Set <String >> getDisabled () {
105+ return ImmutableMap .of ();
106+ }
103107
104108 @ Value .Default
105- default boolean isFailOnUnknownTokens () {
109+ public boolean isFailOnUnknownTokens () {
106110 return false ;
107111 }
108112
109113 @ Value .Default
110- default boolean isNestedInterpretationEnabled () {
114+ public boolean isNestedInterpretationEnabled () {
111115 return false ; // Default changed to false in 3.0
112116 }
113117
114118 @ Value .Default
115- default RandomNumberGeneratorStrategy getRandomNumberGeneratorStrategy () {
119+ public RandomNumberGeneratorStrategy getRandomNumberGeneratorStrategy () {
116120 return RandomNumberGeneratorStrategy .THREAD_LOCAL ;
117121 }
118122
119123 @ Value .Default
120- default boolean isValidationMode () {
124+ public boolean isValidationMode () {
121125 return false ;
122126 }
123127
124128 @ Value .Default
125- default long getMaxStringLength () {
129+ public long getMaxStringLength () {
126130 return getMaxOutputSize ();
127131 }
128132
129133 @ Value .Default
130- default int getMaxListSize () {
134+ public int getMaxListSize () {
131135 return Integer .MAX_VALUE ;
132136 }
133137
134138 @ Value .Default
135- default int getMaxMapSize () {
139+ public int getMaxMapSize () {
136140 return Integer .MAX_VALUE ;
137141 }
138142
139143 @ Value .Default
140- default int getRangeLimit () {
144+ public int getRangeLimit () {
141145 return DEFAULT_RANGE_LIMIT ;
142146 }
143147
144148 @ Value .Default
145- default int getMaxNumDeferredTokens () {
149+ public int getMaxNumDeferredTokens () {
146150 return 1000 ;
147151 }
148152
149153 @ Value .Default
150- default InterpreterFactory getInterpreterFactory () {
154+ public InterpreterFactory getInterpreterFactory () {
151155 return new JinjavaInterpreterFactory ();
152156 }
153157
154158 @ Value .Default
155- default DateTimeProvider getDateTimeProvider () {
159+ public DateTimeProvider getDateTimeProvider () {
156160 return new CurrentDateTimeProvider ();
157161 }
158162
159163 @ Value .Default
160- default TokenScannerSymbols getTokenScannerSymbols () {
164+ public TokenScannerSymbols getTokenScannerSymbols () {
161165 return new DefaultTokenScannerSymbols ();
162166 }
163167
164168 @ Value .Default
165- default AllowlistMethodValidator getMethodValidator () {
169+ public AllowlistMethodValidator getMethodValidator () {
166170 return AllowlistMethodValidator .DEFAULT ;
167171 }
168172
169173 @ Value .Default
170- default AllowlistReturnTypeValidator getReturnTypeValidator () {
174+ public AllowlistReturnTypeValidator getReturnTypeValidator () {
171175 return AllowlistReturnTypeValidator .DEFAULT ;
172176 }
173177
174178 @ Value .Default
175- default ELResolver getElResolver () {
179+ public ELResolver getElResolver () {
176180 return isDefaultReadOnlyResolver ()
177181 ? JinjavaInterpreterResolver .DEFAULT_RESOLVER_READ_ONLY
178182 : JinjavaInterpreterResolver .DEFAULT_RESOLVER_READ_WRITE ;
179183 }
180184
181185 @ Value .Default
182- default boolean isDefaultReadOnlyResolver () {
186+ public boolean isDefaultReadOnlyResolver () {
183187 return true ;
184188 }
185189
186190 @ Value .Default
187- default ExecutionMode getExecutionMode () {
191+ public ExecutionMode getExecutionMode () {
188192 return DefaultExecutionMode .instance ();
189193 }
190194
191195 @ Value .Default
192- default LegacyOverrides getLegacyOverrides () {
196+ public LegacyOverrides getLegacyOverrides () {
193197 return LegacyOverrides .THREE_POINT_0 ;
194198 }
195199
196200 @ Value .Default
197- default boolean getEnablePreciseDivideFilter () {
201+ public boolean getEnablePreciseDivideFilter () {
198202 return false ;
199203 }
200204
201205 @ Value .Default
202- default boolean isEnableFilterChainOptimization () {
206+ public boolean isEnableFilterChainOptimization () {
203207 return false ;
204208 }
205209
206210 @ Value .Default
207- default ObjectMapper getObjectMapper () {
211+ public ObjectMapper getObjectMapper () {
208212 ObjectMapper objectMapper = new ObjectMapper ().registerModule (new Jdk8Module ());
209213 if (getLegacyOverrides ().isUseSnakeCasePropertyNaming ()) {
210214 objectMapper .setPropertyNamingStrategy (PropertyNamingStrategies .SNAKE_CASE );
@@ -213,42 +217,42 @@ default ObjectMapper getObjectMapper() {
213217 }
214218
215219 @ Value .Default
216- default ObjectUnwrapper getObjectUnwrapper () {
220+ public ObjectUnwrapper getObjectUnwrapper () {
217221 return new JinjavaObjectUnwrapper ();
218222 }
219223
220224 @ Value .Derived
221- default Features getFeatures () {
225+ public Features getFeatures () {
222226 return new Features (getFeatureConfig ());
223227 }
224228
225229 @ Value .Default
226- default FeatureConfig getFeatureConfig () {
230+ public FeatureConfig getFeatureConfig () {
227231 return FeatureConfig .newBuilder ().build ();
228232 }
229233
230234 @ Value .Default
231- default JinjavaProcessors getProcessors () {
235+ public JinjavaProcessors getProcessors () {
232236 return JinjavaProcessors .newBuilder ().build ();
233237 }
234238
235239 @ Deprecated
236- default BiConsumer <Node , JinjavaInterpreter > getNodePreProcessor () {
240+ public BiConsumer <Node , JinjavaInterpreter > getNodePreProcessor () {
237241 return getProcessors ().getNodePreProcessor ();
238242 }
239243
240244 @ Deprecated
241- default boolean isIterateOverMapKeys () {
245+ public boolean isIterateOverMapKeys () {
242246 return getLegacyOverrides ().isIterateOverMapKeys ();
243247 }
244248
245- class Builder extends ImmutableJinjavaConfig .Builder {}
249+ public static class Builder extends ImmutableJinjavaConfig .Builder {}
246250
247- static Builder builder () {
251+ public static Builder builder () {
248252 return new Builder ();
249253 }
250254
251- static Builder newBuilder () {
255+ public static Builder newBuilder () {
252256 return builder ();
253257 }
254258}
0 commit comments