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+ @ Value .Default
105+ public Map <Library , Set <String >> getDisabled () {
106+ return ImmutableMap .of ();
107+ }
103108
104109 @ Value .Default
105- default boolean isFailOnUnknownTokens () {
110+ public boolean isFailOnUnknownTokens () {
106111 return false ;
107112 }
108113
109114 @ Value .Default
110- default boolean isNestedInterpretationEnabled () {
115+ public boolean isNestedInterpretationEnabled () {
111116 return false ; // Default changed to false in 3.0
112117 }
113118
114119 @ Value .Default
115- default RandomNumberGeneratorStrategy getRandomNumberGeneratorStrategy () {
120+ public RandomNumberGeneratorStrategy getRandomNumberGeneratorStrategy () {
116121 return RandomNumberGeneratorStrategy .THREAD_LOCAL ;
117122 }
118123
119124 @ Value .Default
120- default boolean isValidationMode () {
125+ public boolean isValidationMode () {
121126 return false ;
122127 }
123128
124129 @ Value .Default
125- default long getMaxStringLength () {
130+ public long getMaxStringLength () {
126131 return getMaxOutputSize ();
127132 }
128133
129134 @ Value .Default
130- default int getMaxListSize () {
135+ public int getMaxListSize () {
131136 return Integer .MAX_VALUE ;
132137 }
133138
134139 @ Value .Default
135- default int getMaxMapSize () {
140+ public int getMaxMapSize () {
136141 return Integer .MAX_VALUE ;
137142 }
138143
139144 @ Value .Default
140- default int getRangeLimit () {
145+ public int getRangeLimit () {
141146 return DEFAULT_RANGE_LIMIT ;
142147 }
143148
144149 @ Value .Default
145- default int getMaxNumDeferredTokens () {
150+ public int getMaxNumDeferredTokens () {
146151 return 1000 ;
147152 }
148153
149154 @ Value .Default
150- default InterpreterFactory getInterpreterFactory () {
155+ public InterpreterFactory getInterpreterFactory () {
151156 return new JinjavaInterpreterFactory ();
152157 }
153158
154159 @ Value .Default
155- default DateTimeProvider getDateTimeProvider () {
160+ public DateTimeProvider getDateTimeProvider () {
156161 return new CurrentDateTimeProvider ();
157162 }
158163
159164 @ Value .Default
160- default TokenScannerSymbols getTokenScannerSymbols () {
165+ public TokenScannerSymbols getTokenScannerSymbols () {
161166 return new DefaultTokenScannerSymbols ();
162167 }
163168
164169 @ Value .Default
165- default AllowlistMethodValidator getMethodValidator () {
170+ public AllowlistMethodValidator getMethodValidator () {
166171 return AllowlistMethodValidator .DEFAULT ;
167172 }
168173
169174 @ Value .Default
170- default AllowlistReturnTypeValidator getReturnTypeValidator () {
175+ public AllowlistReturnTypeValidator getReturnTypeValidator () {
171176 return AllowlistReturnTypeValidator .DEFAULT ;
172177 }
173178
174179 @ Value .Default
175- default ELResolver getElResolver () {
180+ public ELResolver getElResolver () {
176181 return isDefaultReadOnlyResolver ()
177182 ? JinjavaInterpreterResolver .DEFAULT_RESOLVER_READ_ONLY
178183 : JinjavaInterpreterResolver .DEFAULT_RESOLVER_READ_WRITE ;
179184 }
180185
181186 @ Value .Default
182- default boolean isDefaultReadOnlyResolver () {
187+ public boolean isDefaultReadOnlyResolver () {
183188 return true ;
184189 }
185190
186191 @ Value .Default
187- default ExecutionMode getExecutionMode () {
192+ public ExecutionMode getExecutionMode () {
188193 return DefaultExecutionMode .instance ();
189194 }
190195
191196 @ Value .Default
192- default LegacyOverrides getLegacyOverrides () {
197+ public LegacyOverrides getLegacyOverrides () {
193198 return LegacyOverrides .THREE_POINT_0 ;
194199 }
195200
196201 @ Value .Default
197- default boolean getEnablePreciseDivideFilter () {
202+ public boolean getEnablePreciseDivideFilter () {
198203 return false ;
199204 }
200205
201206 @ Value .Default
202- default boolean isEnableFilterChainOptimization () {
207+ public boolean isEnableFilterChainOptimization () {
203208 return false ;
204209 }
205210
206211 @ Value .Default
207- default ObjectMapper getObjectMapper () {
212+ public ObjectMapper getObjectMapper () {
208213 ObjectMapper objectMapper = new ObjectMapper ().registerModule (new Jdk8Module ());
209214 if (getLegacyOverrides ().isUseSnakeCasePropertyNaming ()) {
210215 objectMapper .setPropertyNamingStrategy (PropertyNamingStrategies .SNAKE_CASE );
@@ -213,42 +218,42 @@ default ObjectMapper getObjectMapper() {
213218 }
214219
215220 @ Value .Default
216- default ObjectUnwrapper getObjectUnwrapper () {
221+ public ObjectUnwrapper getObjectUnwrapper () {
217222 return new JinjavaObjectUnwrapper ();
218223 }
219224
220225 @ Value .Derived
221- default Features getFeatures () {
226+ public Features getFeatures () {
222227 return new Features (getFeatureConfig ());
223228 }
224229
225230 @ Value .Default
226- default FeatureConfig getFeatureConfig () {
231+ public FeatureConfig getFeatureConfig () {
227232 return FeatureConfig .newBuilder ().build ();
228233 }
229234
230235 @ Value .Default
231- default JinjavaProcessors getProcessors () {
236+ public JinjavaProcessors getProcessors () {
232237 return JinjavaProcessors .newBuilder ().build ();
233238 }
234239
235240 @ Deprecated
236- default BiConsumer <Node , JinjavaInterpreter > getNodePreProcessor () {
241+ public BiConsumer <Node , JinjavaInterpreter > getNodePreProcessor () {
237242 return getProcessors ().getNodePreProcessor ();
238243 }
239244
240245 @ Deprecated
241- default boolean isIterateOverMapKeys () {
246+ public boolean isIterateOverMapKeys () {
242247 return getLegacyOverrides ().isIterateOverMapKeys ();
243248 }
244249
245- class Builder extends ImmutableJinjavaConfig .Builder {}
250+ public static class Builder extends ImmutableJinjavaConfig .Builder {}
246251
247- static Builder builder () {
252+ public static Builder builder () {
248253 return new Builder ();
249254 }
250255
251- static Builder newBuilder () {
256+ public static Builder newBuilder () {
252257 return builder ();
253258 }
254259}
0 commit comments