Interface ConverterOptions

All Known Implementing Classes:
DefaultConverterOptions

public interface ConverterOptions
Configuration options for the Converter class, providing customization of type conversion behavior. This interface defines default settings and allows overriding of conversion parameters like timezone, locale, and character encoding.

The interface provides default implementations for all methods, allowing implementations to override only the settings they need to customize.

Key features include:

  • Time zone and locale settings for date/time conversions
  • Character encoding configuration
  • Custom ClassLoader specification
  • Boolean-to-Character conversion mapping
  • Custom conversion override capabilities

Example usage:


 ConverterOptions options = new ConverterOptions() {
     @Override
     public ZoneId getZoneId() {
         return ZoneId.of("UTC");
     }

     @Override
     public Locale getLocale() {
         return Locale.US;
     }
 };
 
Author:
John DeRegnaucourt ([email protected]) Kenny Partlow ([email protected])
Copyright (c) Cedar Software LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

License

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
See Also:
  • Method Details

    • getZoneId

      default ZoneId getZoneId()
      Returns:
      ZoneId to use for source conversion when one is not provided and is required on the target type. i.e. LocalDateTime, LocalDate, or String when no zone is provided.
    • getLocale

      default Locale getLocale()
      Returns:
      Locale to use as target when converting between types that require a Locale.
    • getCharset

      default Charset getCharset()
      Returns:
      Charset to use as target Charset on types that require a Charset during conversion (if required).
    • getClassLoader

      default ClassLoader getClassLoader()
      Returns:
      ClassLoader for loading and initializing classes.
    • getCustomOption

      default <T> T getCustomOption(String name)
      Returns:
      Custom option
    • getTimeZone

      default TimeZone getTimeZone()
      Returns:
      TimeZone expected on the target when finished (only for types that support ZoneId or TimeZone).
    • trueChar

      default Character trueChar()
      Character to return for boolean to Character conversion when the boolean is true.
      Returns:
      the Character representing true.
    • falseChar

      default Character falseChar()
      Character to return for boolean to Character conversion when the boolean is false.
      Returns:
      the Character representing false.
    • getConverterOverrides

      default Map<Converter.ConversionPair,Convert<?>> getConverterOverrides()
      Overrides for converter conversions.
      Returns:
      The Map of overrides.