public interface ProjectFileExtension<T extends ProjectFile,U extends ProjectFileBuilder<T>>
In order to add a new type of project file to your AppData
instance,
you need to implement that interface and declare it to the runtime using the
AutoService
annotation.
The instance needs to define the new class, a name identifying that class ("pseudo class"), and to provide a builder object to create an actual instance of the new class. For instance:
@AutoService(ProjectFileExtension.class) public class FooFileExtension implements ProjectFileExtension{ @Override public Class getProjectFileClass() { return FooFile.class; } @Override public String getProjectFilePseudoClass() { return "foo"; } @Override public Class getProjectFileBuilderClass() { return FooFileBuilder.class; } @Override public FooFile createProjectFile(ProjectFileCreationContext context) { return new FooFile(context); } @Override public FooFileBuilder createProjectFileBuilder(ProjectFileBuildContext context) { return new FooFileBuilder(context); } }
Modifier and Type | Method and Description |
---|---|
T |
createProjectFile(ProjectFileCreationContext context)
Creates an object with default constructor.
|
ProjectFileBuilder<T> |
createProjectFileBuilder(ProjectFileBuildContext context)
Creates a builder object, to build an instance of the new type with additional parameters passed to the builder.
|
java.lang.Class<U> |
getProjectFileBuilderClass()
The builder class for the new type.
|
java.lang.Class<T> |
getProjectFileClass()
The new project file type to be injected.
|
java.lang.String |
getProjectFilePseudoClass()
A "pseudo class" name for the new type.
|
java.lang.Class<T> getProjectFileClass()
java.lang.String getProjectFilePseudoClass()
java.lang.Class<U> getProjectFileBuilderClass()
T createProjectFile(ProjectFileCreationContext context)
ProjectFileBuilder<T> createProjectFileBuilder(ProjectFileBuildContext context)
Copyright © 2019. All rights reserved.