public interface ArtifactManager
Modifier and Type | Field and Description |
---|---|
static List<GriffonClass> |
EMPTY_GRIFFON_CLASS_LIST |
Modifier and Type | Method and Description |
---|---|
<A extends GriffonArtifact> |
findGriffonClass(A artifact)
Finds an artifact by class.
|
GriffonClass |
findGriffonClass(Class<? extends GriffonArtifact> clazz)
Finds an artifact by class.
|
GriffonClass |
findGriffonClass(Class<? extends GriffonArtifact> clazz,
String type)
Finds an artifact by class and type.
|
GriffonClass |
findGriffonClass(String fqClassName)
Finds an artifact by name.
|
GriffonClass |
findGriffonClass(String name,
String type)
Finds an artifact by name and type.
|
List<GriffonClass> |
getAllClasses()
Finds all artifact classes.
|
Set<String> |
getAllTypes()
Finds all supported artifact types.
|
List<GriffonClass> |
getClassesOfType(String type)
Finds all artifacts of an specific type.
|
void |
loadArtifactMetadata()
Reads the artifacts definitions file from the classpath.
|
<A extends GriffonArtifact> |
newInstance(Class<A> clazz)
Creates a new instance of the specified class and type.
Triggers the ApplicationEvent.NEW_INSTANCE with the following parameters clazz - the Class of the object instance -> the object that was created |
<A extends GriffonArtifact> |
newInstance(GriffonClass griffonClass)
Creates a new instance of the specified class and type.
Triggers the ApplicationEvent.NEW_INSTANCE with the following parameters clazz - the Class of the object instance -> the object that was created |
void |
registerArtifactHandler(ArtifactHandler handler)
Registers an ArtifactHandler by type.
|
void |
unregisterArtifactHandler(ArtifactHandler handler)
Removes an ArtifactHandler by type.
|
static final List<GriffonClass> EMPTY_GRIFFON_CLASS_LIST
void registerArtifactHandler(@Nonnull ArtifactHandler handler)
Should call initialize() on the handler.
handler
- an ArtifactHandlervoid unregisterArtifactHandler(@Nonnull ArtifactHandler handler)
handler
- an ArtifactHandlervoid loadArtifactMetadata()
Should call initialize() on artifact handlers if there are any registered already.
@Nullable GriffonClass findGriffonClass(@Nonnull String name, @Nonnull String type)
Example: findGriffonClass("Book", "controller") will return an artifact class that describes BookController.
name
- the name of the artifact, e.g. 'Book'type
- the type of the artifact, e.g. 'controller'@Nullable GriffonClass findGriffonClass(@Nonnull Class<? extends GriffonArtifact> clazz, @Nonnull String type)
Example: findGriffonClass(BookController, "controller") will return an artifact class that describes BookController.
clazz
- the name of the artifact, e.g. com.acme.BookControllertype
- the type of the artifact, e.g. 'controller'@Nullable <A extends GriffonArtifact> GriffonClass findGriffonClass(@Nonnull A artifact)
Example: findGriffonClass(aBookControllerInstance) will return an artifact class that describes BookController.
artifact
- an artifact instance@Nullable GriffonClass findGriffonClass(@Nonnull Class<? extends GriffonArtifact> clazz)
Example: findGriffonClass(BookController) will return an artifact class that describes BookController.
clazz
- a Class instance@Nullable GriffonClass findGriffonClass(@Nonnull String fqClassName)
Example: findGriffonClass("BookController") will return an artifact class that describes BookController.
fqClassName
- full qualified class name@Nonnull List<GriffonClass> getClassesOfType(@Nonnull String type)
Example: getClassesOfType("controller") will return all artifact classes that describe controllers.
type
- an artifact type, e.g. 'controller'@Nonnull Set<String> getAllTypes()
@Nonnull List<GriffonClass> getAllClasses()
@Nonnull <A extends GriffonArtifact> A newInstance(@Nonnull GriffonClass griffonClass)
griffonClass
- the GriffonClass for which an instance must be createdArtifactNotFoundException
- if there's no artifact configured
matching the given criteria@Nonnull <A extends GriffonArtifact> A newInstance(@Nonnull Class<A> clazz)
clazz
- the Class for which an instance must be createdArtifactNotFoundException
- if there's no artifact configured
matching the given criteria