public abstract class AbstractArtifactHandler<A extends GriffonArtifact> extends Object implements ArtifactHandler<A>
| Modifier and Type | Field and Description |
|---|---|
protected static String |
ERROR_CLASS_NULL |
| Constructor and Description |
|---|
AbstractArtifactHandler(GriffonApplication application,
Class<A> artifactType,
String type,
String trailing) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createBindings(List<Binding<?>> bindings,
Class<A> clazz,
GriffonClass griffonClass) |
GriffonClass |
findClassFor(String propertyName)
Finds an artifact by its property name.
|
protected GriffonApplication |
getApplication() |
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.
|
Collection<Binding<?>> |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewGriffonClassInstanceprotected static final String ERROR_CLASS_NULL
@Nonnull public Class<A> getArtifactType()
getArtifactType in interface ArtifactHandler<A extends GriffonArtifact>@Nonnull public String getType()
ArtifactHandlergetType in interface ArtifactHandler<A extends GriffonArtifact>@Nonnull public String getTrailing()
ArtifactHandlerMay be empty but non-null.
getTrailing in interface ArtifactHandler<A extends GriffonArtifact>@Nonnull public Collection<Binding<?>> initialize(@Nonnull 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 manageprotected void createBindings(@Nonnull List<Binding<?>> bindings, @Nonnull Class<A> clazz, @Nonnull GriffonClass griffonClass)
@Nonnull public Map<String,GriffonClass> getClassesByName()
getClassesByName in interface ArtifactHandler<A extends GriffonArtifact>public boolean isArtifact(@Nonnull 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 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 String fqnClassName)
ArtifactHandlergetClassFor in interface ArtifactHandler<A extends GriffonArtifact>fqnClassName - a full qualified class name, i.e, "book.BookController"@Nullable public GriffonClass findClassFor(@Nonnull 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()