Class DozerConverter<A,​B>

    • Constructor Detail

      • DozerConverter

        public DozerConverter​(Class<A> prototypeA,
                              Class<B> prototypeB)
        Defines two types, which will take part transformation. As Dozer supports bi-directional mapping it is not known which of the classes is source and which is destination. It will be decided in runtime.
        Parameters:
        prototypeA - type one
        prototypeB - type two
    • Method Detail

      • convertTo

        public abstract B convertTo​(A source,
                                    B destination)
        Converts the source field to the destination field and return the resulting destination value.
        Parameters:
        source - the value of the source field
        destination - the current value of the destination field (or null)
        Returns:
        the resulting value for the destination field
      • convertTo

        public B convertTo​(A source)
        Converts the source field to the destination field and return the resulting destination value.
        Parameters:
        source - the value of the source field
        Returns:
        the resulting value for the destination field
      • convertFrom

        public abstract A convertFrom​(B source,
                                      A destination)
        Converts the source field to the destination field and return the resulting destination value
        Parameters:
        source - the value of the source field
        destination - the current value of the destination field (or null)
        Returns:
        the resulting value for the destination field
      • convertFrom

        public A convertFrom​(B source)
        Converts the source field to the destination field and return the resulting destination value
        Parameters:
        source - the value of the source field
        Returns:
        the resulting value for the destination field
      • setParameter

        public void setParameter​(String parameter)
        Sets the configured parameter value for this converter instance. Should be called by Dozer internally before actual mapping.
        Specified by:
        setParameter in interface ConfigurableCustomConverter
        Parameters:
        parameter - configured parameter value
      • getParameter

        public String getParameter()
        Retrieves the static parameter configured for this particular converter instance. It is not advisable to call this method from converter constructor as the parameter is not yet there.
        Returns:
        parameter value
        Throws:
        IllegalStateException - if parameter has not been set yet.