Interface TransformFactory

  • All Known Implementing Classes:
    StandardTransformFactory

    public interface TransformFactory
    Different Transform implementations can be installed in the TransformFactory to be instantiated when needed. The transforms are ordered in a graph-like manner so that all tranforms leading away from a particular model type easily can be located.
    Since:
    2.0
    Author:
    Emil Forslund
    • Method Detail

      • getName

        String getName()
        Returns a unique name of this factory. This can be used to identify a particular factory if multiple ones are used in the same generator.
        Returns:
        the unique name
      • install

        default <A,​T extends Transform<A,​String>> TransformFactory install​(Class<A> from,
                                                                                       Supplier<T> transformer)
        Installs the specified Transform, assuming that the resulting class is a String.
        Type Parameters:
        A - the type to transform from
        T - the transformer
        Parameters:
        from - the model
        transformer - the view
        Returns:
        a reference to this
      • install

        <A,​B,​T extends Transform<A,​B>> TransformFactory install​(Class<A> from,
                                                                                  Class<B> to,
                                                                                  Supplier<T> transformer)
        Installs the specified Transform.
        Type Parameters:
        A - the type to transform from
        B - the type to transform to
        T - the transformer
        Parameters:
        from - the model class to transform from
        to - the model class to transform to
        transformer - the view
        Returns:
        a reference to this
      • allFrom

        <A,​T extends Transform<A,​?>> Set<Map.Entry<Class<?>,​T>> allFrom​(Class<A> from)
        Builds a stream of all transforms that match the specified model.
        Type Parameters:
        A - the class to transform from
        T - the transformer
        Parameters:
        from - the model class to transform from
        Returns:
        a stream of all matching transforms