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

Type Parameters:
W - Type of SymbolWriter to create.
All Superinterfaces:
BiFunction<String,String,W>
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 BiFunction<String,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

    Modifier and Type
    Method
    Description
    apply(String filename, String namespace)
    Creates a SymbolWriter of type W for the given filename and namespace.

    Methods inherited from interface java.util.function.BiFunction

    andThen
  • Method Details

    • apply

      W apply(String filename, String namespace)
      Creates a SymbolWriter of type W for the given filename and namespace.
      Specified by:
      apply in interface BiFunction<String,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.