Interface SymbolWriter.Factory<W extends SymbolWriter<W,​? extends ImportContainer>>

  • Type Parameters:
    W - Type of SymbolWriter to create.
    All Superinterfaces:
    java.util.function.BiFunction<java.lang.String,​java.lang.String,​W>
    All Known Implementing Classes:
    TraitCodegenWriter.Factory
    Enclosing class:
    SymbolWriter<W extends SymbolWriter<W,​I>,​I extends ImportContainer>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public static interface SymbolWriter.Factory<W extends SymbolWriter<W,​? extends ImportContainer>>
    extends java.util.function.BiFunction<java.lang.String,​java.lang.String,​W>
    Factory used to create a SymbolWriter.

    The following example shows how to implement a basic Factory.

    
     public final class MyWriterFactory implements SymbolWriter.Factory<MyWriter> {
         \@Override
         public MyWriter apply(String filename, String namespace) {
             return new MyWriter(namespace);
         }
     }
     

    Because this class is a FunctionalInterface, it can be implemented using a lambda expression:

    
     SymbolWriter.Factory<MyWriter> = (filename, namespace) -> new MyWriter(namespace);
     
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      W apply​(java.lang.String filename, java.lang.String namespace)
      Creates a SymbolWriter of type W for the given filename and namespace.
      • Methods inherited from interface java.util.function.BiFunction

        andThen
    • Method Detail

      • apply

        W apply​(java.lang.String filename,
                java.lang.String namespace)
        Creates a SymbolWriter of type W for the given filename and namespace.
        Specified by:
        apply in interface java.util.function.BiFunction<java.lang.String,​java.lang.String,​W extends SymbolWriter<W,​? extends ImportContainer>>
        Parameters:
        filename - Non-null filename of the writer being created.
        namespace - Non-null namespace associated with the file (possibly empty string).
        Returns:
        Returns the created writer of type W.