Class FormattedTemporalConverter<T extends java.time.temporal.TemporalAccessor>

  • All Implemented Interfaces:
    java.io.Serializable, Converter<java.lang.String,​T,​Component>

    public class FormattedTemporalConverter<T extends java.time.temporal.TemporalAccessor>
    extends java.lang.Object
    implements Converter<java.lang.String,​T,​Component>, java.io.Serializable
    Converter to convert String to Temporal object.
    Since:
    9.0.0
    Author:
    rudyhuang
    See Also:
    Serialized Form
    • Constructor Detail

      • FormattedTemporalConverter

        public FormattedTemporalConverter​(java.time.temporal.TemporalQuery<T> parseTo)
        Construct with a parseTo method.
        Parameters:
        parseTo - Temporal method parsed to
    • Method Detail

      • coerceToUi

        public java.lang.String coerceToUi​(T beanProp,
                                           Component component,
                                           BindContext ctx)
        Convert Temporal to String.
        Specified by:
        coerceToUi in interface Converter<java.lang.String,​T extends java.time.temporal.TemporalAccessor,​Component>
        Parameters:
        beanProp - temporal to be converted
        component - associated component
        ctx - bind context for associate Binding and extra parameter (e.g. format)
        Returns:
        the converted temporal as String
      • coerceToBean

        public T coerceToBean​(java.lang.String compAttr,
                              Component component,
                              BindContext ctx)
        Convert String to Temporal.
        Specified by:
        coerceToBean in interface Converter<java.lang.String,​T extends java.time.temporal.TemporalAccessor,​Component>
        Parameters:
        compAttr - temporal in string form
        component - associated component
        ctx - bind context for associate Binding and extra parameter (e.g. format)
        Returns:
        the converted Temporal