io.jooby.internal.apt.Source Maven / Gradle / Ivy
package ${packageName};
${imports}
@io.jooby.annotation.Generated(${className}.class)
public class ${generatedClassName} implements io.jooby.MvcExtension, io.jooby.MvcFactory<${className}> {
protected final java.util.function.Function factory;
${constructors}
public ${generatedClassName}(${className} instance) {
this(ctx -> instance);
}
public ${generatedClassName}(java.util.function.Supplier<${className}> provider) {
this(ctx -> provider.get());
}
public ${generatedClassName}(java.util.function.Function factory) {
this.factory = factory;
}
${methods}
public boolean supports(Class<${className}> type) {
return type == ${className}.class;
}
public io.jooby.Extension create(java.util.function.Supplier<${className}> provider) {
return new ${generatedClassName}(provider);
}
}