Class AbstractConverter<S,​T>

    • Field Detail

      • logger

        protected final Logger logger
    • Constructor Detail

      • AbstractConverter

        public AbstractConverter()
    • Method Detail

      • convert

        @Nullable
        public final T convert​(@Nullable
                               S source)
        Description copied from interface: Converter
        Convert the source-typed value to the target-typed value
        Specified by:
        convert in interface Converter<S,​T>
        Parameters:
        source - the source-typed value
        Returns:
        the target-typed value
      • doConvert

        @Nullable
        protected abstract T doConvert​(@Nonnull
                                       S source)
                                throws java.lang.Throwable
        Converts the non-null source-typed value to the target-typed value.

        This method is called by convert(Object) after checking if the source is null. Subclasses must implement this method to provide the actual conversion logic.

        Parameters:
        source - the non-null source-typed value
        Returns:
        the converted target-typed value, or null if conversion is not possible
        Throws:
        java.lang.Throwable - if an error occurs during conversion
      • resolvePriority

        protected java.lang.Integer resolvePriority()
        Resolve the priority based on the inheritance hierarchy depth of source and target types.

        The priority is calculated by combining the number of superclasses and interfaces from both the source and target types. This ensures more specific converters (those handling more derived types) receive higher priority.

        Returns:
        the resolved priority as an Integer, negative value indicates higher priority
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object