Package com.cedarsoftware.util.convert
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 Summary
Modifier and TypeMethodDescriptiondefault Character
Character to return for boolean to Character conversion when the boolean is false.default Charset
default ClassLoader
default Map<Converter.ConversionPair,
Convert<?>> Overrides for converter conversions.default <T> T
getCustomOption
(String name) Accessor for all custom options defined on this instance.default Locale
default TimeZone
default ZoneId
default Character
trueChar()
Character to return for boolean to Character conversion when the boolean is true.
-
Method Details
-
getZoneId
- Returns:
ZoneId
to use for source conversion when one is not provided and is required on the target type. i.e.LocalDateTime
,LocalDate
, orString
when no zone is provided.
-
getLocale
- Returns:
- Locale to use as target when converting between types that require a Locale.
-
getCharset
- Returns:
- Charset to use as target Charset on types that require a Charset during conversion (if required).
-
getClassLoader
- Returns:
- ClassLoader for loading and initializing classes.
-
getCustomOption
- Returns:
- Custom option
-
getCustomOptions
Accessor for all custom options defined on this instance.- Returns:
- the map of custom options
-
getTimeZone
- Returns:
- TimeZone expected on the target when finished (only for types that support ZoneId or TimeZone).
-
trueChar
Character to return for boolean to Character conversion when the boolean is true.- Returns:
- the Character representing true.
-
falseChar
Character to return for boolean to Character conversion when the boolean is false.- Returns:
- the Character representing false.
-
getConverterOverrides
Overrides for converter conversions.- Returns:
- The Map of overrides.
-