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+
59+ public JinjavaConfig () {}
60+
5761 @ Value .Default
58- default Charset getCharset () {
62+ public Charset getCharset () {
5963 return StandardCharsets .UTF_8 ;
6064 }
6165
6266 @ Value .Default
63- default Locale getLocale () {
67+ public Locale getLocale () {
6468 return Locale .ENGLISH ;
6569 }
6670
6771 @ Value .Default
68- default ZoneId getTimeZone () {
72+ public ZoneId getTimeZone () {
6973 return ZoneOffset .UTC ;
7074 }
7175
7276 @ Value .Default
73- default int getMaxRenderDepth () {
77+ public int getMaxRenderDepth () {
7478 return 10 ;
7579 }
7680
7781 @ Value .Default
78- default long getMaxOutputSize () {
82+ public long getMaxOutputSize () {
7983 return 0 ;
8084 }
8185
8286 @ Value .Default
83- default boolean isTrimBlocks () {
87+ public boolean isTrimBlocks () {
8488 return false ;
8589 }
8690
8791 @ Value .Default
88- default boolean isLstripBlocks () {
92+ public boolean isLstripBlocks () {
8993 return false ;
9094 }
9195
9296 @ Value .Default
93- default boolean isEnableRecursiveMacroCalls () {
97+ public boolean isEnableRecursiveMacroCalls () {
9498 return false ;
9599 }
96100
97101 @ Value .Default
98- default int getMaxMacroRecursionDepth () {
102+ public int getMaxMacroRecursionDepth () {
99103 return 0 ;
100104 }
101105
102- Map <Library , Set <String >> getDisabled ();
106+ @ Value .Default
107+ public Map <Library , Set <String >> getDisabled () {
108+ return ImmutableMap .of ();
109+ }
103110
104111 @ Value .Default
105- default boolean isFailOnUnknownTokens () {
112+ public boolean isFailOnUnknownTokens () {
106113 return false ;
107114 }
108115
109116 @ Value .Default
110- default boolean isNestedInterpretationEnabled () {
117+ public boolean isNestedInterpretationEnabled () {
111118 return false ; // Default changed to false in 3.0
112119 }
113120
114121 @ Value .Default
115- default RandomNumberGeneratorStrategy getRandomNumberGeneratorStrategy () {
122+ public RandomNumberGeneratorStrategy getRandomNumberGeneratorStrategy () {
116123 return RandomNumberGeneratorStrategy .THREAD_LOCAL ;
117124 }
118125
119126 @ Value .Default
120- default boolean isValidationMode () {
127+ public boolean isValidationMode () {
121128 return false ;
122129 }
123130
124131 @ Value .Default
125- default long getMaxStringLength () {
132+ public long getMaxStringLength () {
126133 return getMaxOutputSize ();
127134 }
128135
129136 @ Value .Default
130- default int getMaxListSize () {
137+ public int getMaxListSize () {
131138 return Integer .MAX_VALUE ;
132139 }
133140
134141 @ Value .Default
135- default int getMaxMapSize () {
142+ public int getMaxMapSize () {
136143 return Integer .MAX_VALUE ;
137144 }
138145
139146 @ Value .Default
140- default int getRangeLimit () {
147+ public int getRangeLimit () {
141148 return DEFAULT_RANGE_LIMIT ;
142149 }
143150
144151 @ Value .Default
145- default int getMaxNumDeferredTokens () {
152+ public int getMaxNumDeferredTokens () {
146153 return 1000 ;
147154 }
148155
149156 @ Value .Default
150- default InterpreterFactory getInterpreterFactory () {
157+ public InterpreterFactory getInterpreterFactory () {
151158 return new JinjavaInterpreterFactory ();
152159 }
153160
154161 @ Value .Default
155- default DateTimeProvider getDateTimeProvider () {
162+ public DateTimeProvider getDateTimeProvider () {
156163 return new CurrentDateTimeProvider ();
157164 }
158165
159166 @ Value .Default
160- default TokenScannerSymbols getTokenScannerSymbols () {
167+ public TokenScannerSymbols getTokenScannerSymbols () {
161168 return new DefaultTokenScannerSymbols ();
162169 }
163170
164171 @ Value .Default
165- default AllowlistMethodValidator getMethodValidator () {
172+ public AllowlistMethodValidator getMethodValidator () {
166173 return AllowlistMethodValidator .DEFAULT ;
167174 }
168175
169176 @ Value .Default
170- default AllowlistReturnTypeValidator getReturnTypeValidator () {
177+ public AllowlistReturnTypeValidator getReturnTypeValidator () {
171178 return AllowlistReturnTypeValidator .DEFAULT ;
172179 }
173180
174181 @ Value .Default
175- default ELResolver getElResolver () {
182+ public ELResolver getElResolver () {
176183 return isDefaultReadOnlyResolver ()
177184 ? JinjavaInterpreterResolver .DEFAULT_RESOLVER_READ_ONLY
178185 : JinjavaInterpreterResolver .DEFAULT_RESOLVER_READ_WRITE ;
179186 }
180187
181188 @ Value .Default
182- default boolean isDefaultReadOnlyResolver () {
189+ public boolean isDefaultReadOnlyResolver () {
183190 return true ;
184191 }
185192
186193 @ Value .Default
187- default ExecutionMode getExecutionMode () {
194+ public ExecutionMode getExecutionMode () {
188195 return DefaultExecutionMode .instance ();
189196 }
190197
191198 @ Value .Default
192- default LegacyOverrides getLegacyOverrides () {
199+ public LegacyOverrides getLegacyOverrides () {
193200 return LegacyOverrides .THREE_POINT_0 ;
194201 }
195202
196203 @ Value .Default
197- default boolean getEnablePreciseDivideFilter () {
204+ public boolean getEnablePreciseDivideFilter () {
198205 return false ;
199206 }
200207
201208 @ Value .Default
202- default boolean isEnableFilterChainOptimization () {
209+ public boolean isEnableFilterChainOptimization () {
203210 return false ;
204211 }
205212
206213 @ Value .Default
207- default ObjectMapper getObjectMapper () {
214+ public ObjectMapper getObjectMapper () {
208215 ObjectMapper objectMapper = new ObjectMapper ().registerModule (new Jdk8Module ());
209216 if (getLegacyOverrides ().isUseSnakeCasePropertyNaming ()) {
210217 objectMapper .setPropertyNamingStrategy (PropertyNamingStrategies .SNAKE_CASE );
@@ -213,42 +220,42 @@ default ObjectMapper getObjectMapper() {
213220 }
214221
215222 @ Value .Default
216- default ObjectUnwrapper getObjectUnwrapper () {
223+ public ObjectUnwrapper getObjectUnwrapper () {
217224 return new JinjavaObjectUnwrapper ();
218225 }
219226
220227 @ Value .Derived
221- default Features getFeatures () {
228+ public Features getFeatures () {
222229 return new Features (getFeatureConfig ());
223230 }
224231
225232 @ Value .Default
226- default FeatureConfig getFeatureConfig () {
233+ public FeatureConfig getFeatureConfig () {
227234 return FeatureConfig .newBuilder ().build ();
228235 }
229236
230237 @ Value .Default
231- default JinjavaProcessors getProcessors () {
238+ public JinjavaProcessors getProcessors () {
232239 return JinjavaProcessors .newBuilder ().build ();
233240 }
234241
235242 @ Deprecated
236- default BiConsumer <Node , JinjavaInterpreter > getNodePreProcessor () {
243+ public BiConsumer <Node , JinjavaInterpreter > getNodePreProcessor () {
237244 return getProcessors ().getNodePreProcessor ();
238245 }
239246
240247 @ Deprecated
241- default boolean isIterateOverMapKeys () {
248+ public boolean isIterateOverMapKeys () {
242249 return getLegacyOverrides ().isIterateOverMapKeys ();
243250 }
244251
245- class Builder extends ImmutableJinjavaConfig .Builder {}
252+ public static class Builder extends ImmutableJinjavaConfig .Builder {}
246253
247- static Builder builder () {
254+ public static Builder builder () {
248255 return new Builder ();
249256 }
250257
251- static Builder newBuilder () {
258+ public static Builder newBuilder () {
252259 return builder ();
253260 }
254261}
0 commit comments