public abstract class AbstractArtifactHandler<A extends GriffonArtifact> extends java.lang.Object implements ArtifactHandler<A>
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
ERROR_CLASS_NULL |
| Constructor and Description |
|---|
AbstractArtifactHandler(GriffonApplication application,
java.lang.Class<A> artifactType,
java.lang.String type,
java.lang.String trailing) |
| Modifier and Type | Method and Description |
|---|---|
GriffonClass |
findClassFor(java.lang.String propertyName)
Finds an artifact by its property name.
|
protected GriffonApplication |
getApplication() |
java.lang.Class<A> |
getArtifactType() |
GriffonClass[] |
getClasses()
Returns the set of all artifact classes this handler manages.
|
java.util.Map<java.lang.String,GriffonClass> |
getClassesByName() |
GriffonClass |
getClassFor(java.lang.Class<A> clazz)
Finds an artifact if the target
clazz is handled by this
ArtifactHandler. |
GriffonClass |
getClassFor(java.lang.String fqnClassName)
Finds an artifact by class name if it represents a class that
is handled by this ArtifactHandler.
|
java.lang.String |
getTrailing()
Get the trailing suffix that identifies the artifact.
|
java.lang.String |
getType()
Get the type of artifact this handler processes.
|
void |
initialize(java.lang.Class<A>[] classes)
Initializes the handler with a collection of all available
classes this handler can process.
|
boolean |
isArtifact(java.lang.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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewGriffonClassInstanceprotected static final java.lang.String ERROR_CLASS_NULL
@Inject public AbstractArtifactHandler(@Nonnull GriffonApplication application, @Nonnull java.lang.Class<A> artifactType, @Nonnull java.lang.String type, @Nonnull java.lang.String trailing)
@Nonnull public java.lang.Class<A> getArtifactType()
getArtifactType in interface ArtifactHandler<A extends GriffonArtifact>@Nonnull public java.lang.String getType()
ArtifactHandlergetType in interface ArtifactHandler<A extends GriffonArtifact>@Nonnull public java.lang.String getTrailing()
ArtifactHandlerMay be empty but non-null.
getTrailing in interface ArtifactHandler<A extends GriffonArtifact>public void initialize(@Nonnull
java.lang.Class<A>[] classes)
ArtifactHandlerThis is a good time to pre-emptively instantiate beans or perform additional checks on artifacts.
initialize in interface ArtifactHandler<A extends GriffonArtifact>classes - an array of all classes this handler should manage@Nonnull public java.util.Map<java.lang.String,GriffonClass> getClassesByName()
getClassesByName in interface ArtifactHandler<A extends GriffonArtifact>public boolean isArtifact(@Nonnull
java.lang.Class<A> clazz)
This implementation performs an equality check on class.name
isArtifact in interface ArtifactHandler<A extends GriffonArtifact>clazz - a Class instancepublic boolean isArtifact(@Nonnull
GriffonClass clazz)
ArtifactHandlerisArtifact in interface ArtifactHandler<A extends GriffonArtifact>clazz - a GriffonClass instance@Nonnull public GriffonClass[] getClasses()
ArtifactHandlergetClasses in interface ArtifactHandler<A extends GriffonArtifact>@Nullable public GriffonClass getClassFor(@Nonnull java.lang.Class<A> clazz)
ArtifactHandlerclazz is handled by this
ArtifactHandler.getClassFor in interface ArtifactHandler<A extends GriffonArtifact>clazz - a class object, i.e, BookController@Nullable public GriffonClass getClassFor(@Nonnull java.lang.String fqnClassName)
ArtifactHandlergetClassFor in interface ArtifactHandler<A extends GriffonArtifact>fqnClassName - a full qualified class name, i.e, "book.BookController"@Nullable public GriffonClass findClassFor(@Nonnull java.lang.String propertyName)
ArtifactHandlerExamples: 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.
findClassFor in interface ArtifactHandler<A extends GriffonArtifact>propertyName - the property representation of an artifact, e.g. 'fooService'@Nonnull protected GriffonApplication getApplication()