Griffon 0.9.5-rc2

griffon.core
[Java] Interface ArtifactHandler

griffon.core.ApplicationHandler
  griffon.core.ArtifactHandler
All Superinterfaces:
ApplicationHandler

public interface ArtifactHandler
extends ApplicationHandler

The ArtifactHandler interface's purpose is to allow the analysis of conventions within a Griffon application.

An artifact is represented by the GriffonClass interface and this interface provides methods that allow artifacts to be identified, created and initialized.

Authors:
Andres Almiray


Method Summary
GriffonClass findClassFor(String propertyName)

Finds an artifact by its property name.

GriffonClass getClassFor(Class 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.

GriffonClass[] getClasses()

Returns the set of all artifact classes this handler manages.

String getTrailing()

Get the trailing suffix that identifies the artifact.

String getType()

Get the type of artifact this handler processes.

void initialize(ArtifactInfo[] artifacts)

Initializes the handler with a collection of all available artifacts this handler can process.

boolean isArtifact(Class 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.

 
Methods inherited from interface ApplicationHandler
getApp
 

Method Detail

findClassFor

public GriffonClass findClassFor(String propertyName)
Finds an artifact by its property name.

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.

Parameters:
propertyName - the property representation of an artifact, e.g. 'fooService'
Returns:
a GriffonClass instance if there's a match, null otherwise.


getClassFor

public GriffonClass getClassFor(Class clazz)
Finds an artifact if the target clazz is handled by this ArtifactHandler.

Parameters:
clazz - a class object, i.e, BookController
Returns:
a GriffonClass that can handle the target class or null if the clazz is not handled by this ArtifactHandler.


getClassFor

public GriffonClass getClassFor(String fqnClassName)
Finds an artifact by class name if it represents a class that is handled by this ArtifactHandler.

Parameters:
fqnClassName - a full qualified class name, i.e, "book.BookController"
Returns:
a GriffonClass that can handle the target class or null if the clazz is not handled by this ArtifactHandler.


getClasses

public GriffonClass[] getClasses()
Returns the set of all artifact classes this handler manages.
Returns:
an array of all GriffonClasses managed by this handler. Never returns null.


getTrailing

public String getTrailing()
Get the trailing suffix that identifies the artifact.

May be empty but non-null.

Returns:
the trailing name suffix (if any), e.g. 'Service'


getType

public String getType()
Get the type of artifact this handler processes.
Returns:
the type of artifacts this handler can handle, e.g. 'service'


initialize

public void initialize(ArtifactInfo[] artifacts)
Initializes the handler with a collection of all available artifacts this handler can process.

This is a good time to pre-emptively instantiate beans or perform additional checks on artifacts.

Parameters:
artifacts - an array of all artifacts this handler should manage


isArtifact

public boolean isArtifact(Class clazz)
Returns true if the target Class is a class artifact handled by this object.
Parameters:
clazz - a Class instance
Returns:
true if this handler is capable of handling the artifact class, false otherwise.


isArtifact

public boolean isArtifact(GriffonClass clazz)
Returns true if the target GriffonClass is a class artifact handled by this object.
Parameters:
clazz - a GriffonClass instance
Returns:
true if this handler is capable of handling the clazz parameter, false otherwise.


 

Groovy Documentation