1 /* 2 Copyright (c) 2018 James Ahlborn 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package com.healthmarketscience.jackcess.expr; 18 19 import java.text.DecimalFormat; 20 import java.time.ZoneId; 21 import java.time.format.DateTimeFormatter; 22 23 /** 24 * LocaleContext encapsulates all shared localization state for expression 25 * parsing and evaluation. 26 * 27 * @author James Ahlborn 28 */ 29 public interface LocaleContext 30 { 31 /** 32 * @return the currently configured TemporalConfig (from the 33 * {@link EvalConfig}) 34 */ 35 public TemporalConfig getTemporalConfig(); 36 37 /** 38 * @return an appropriately configured (i.e. locale) DateTimeFormatter for 39 * the given format. 40 */ 41 public DateTimeFormatter createDateFormatter(String formatStr); 42 43 /** 44 * @return the currently configured ZoneId 45 */ 46 public ZoneId getZoneId(); 47 48 /** 49 * @return the currently configured NumericConfig (from the 50 * {@link EvalConfig}) 51 */ 52 public NumericConfig getNumericConfig(); 53 54 /** 55 * @return an appropriately configured (i.e. DecimalFormatSymbols) 56 * DecimalFormat for the given format. 57 */ 58 public DecimalFormat createDecimalFormat(String formatStr); 59 }