public interface ArtifactHandler<A extends GriffonArtifact>
An artifact is represented by the GriffonClass interface and this interface provides methods that allow artifacts to be identified, created and initialized.
Modifier and Type | Method and Description |
---|---|
GriffonClass |
findClassFor(String propertyName)
Finds an artifact by its property name.
|
Class<A> |
getArtifactType() |
GriffonClass[] |
getClasses()
Returns the set of all artifact classes this handler manages.
|
Map<String,GriffonClass> |
getClassesByName() |
GriffonClass |
getClassFor(Class<A> clazz)
Finds an artifact if the target
clazz is handled by this
ArtifactHandler. |
GriffonClass |
getClassFor(String fqnClassName)
Finds an artifact by class name if it represents a class that
is handled by this ArtifactHandler.
|
String |
getTrailing()
Get the trailing suffix that identifies the artifact.
|
String |
getType()
Get the type of artifact this handler processes.
|
void |
initialize(Class<A>[] classes)
Initializes the handler with a collection of all available
classes this handler can process.
|
boolean |
isArtifact(Class<A> clazz)
Returns true if the target Class is a class artifact
handled by this object.
|
boolean |
isArtifact(GriffonClass clazz)
Returns true if the target GriffonClass is a class artifact
handled by this object.
|
GriffonClass |
newGriffonClassInstance(Class<A> clazz) |
@Nonnull String getType()
@Nonnull String getTrailing()
May be empty but non-null.
boolean isArtifact(@Nonnull Class<A> clazz)
clazz
- a Class instanceboolean isArtifact(@Nonnull GriffonClass clazz)
clazz
- a GriffonClass instancevoid initialize(@Nonnull Class<A>[] classes)
This is a good time to pre-emptively instantiate beans or perform additional checks on artifacts.
classes
- an array of all classes this handler should manage@Nonnull GriffonClass[] getClasses()
@Nullable GriffonClass findClassFor(@Nonnull String propertyName)
Examples: findClassfor("fooService") returns an artifact class that can handle FooService.
Should propertyName
contain any dots then the portion
after the last dot will be considered only.
propertyName
- the property representation of an artifact, e.g. 'fooService'@Nullable GriffonClass getClassFor(@Nonnull Class<A> clazz)
clazz
is handled by this
ArtifactHandler.clazz
- a class object, i.e, BookController@Nullable GriffonClass getClassFor(@Nonnull String fqnClassName)
fqnClassName
- a full qualified class name, i.e, "book.BookController"@Nonnull GriffonClass newGriffonClassInstance(@Nonnull Class<A> clazz)
@Nonnull Map<String,GriffonClass> getClassesByName()