|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.roo.classpath.itd.AbstractItdMetadataProvider
public abstract class AbstractItdMetadataProvider
Provides common functionality used by ITD-based generators.
This abstract class assumes:
metadataTriggers
MetadataProvider
are sufficientPhysicalTypeIdentifier
MetadataProvider.getProvidesType()
Put differently, this abstract class assumes every ITD will have a corresponding "governor". A "governor" is defined as the type which will eventually receive the introduction. The abstract class assumes all metadata identification strings represent the name of the governor, albeit with a metadata class specific to the add-on. When an instance-specific metadata identification request is received, the governor will be obtained and in turn introspected for one of the trigger annotations. If these are detected, or if there is already an ITD file of the same name as would normally be created had a trigger annotation been found, the metadata will be created. The metadata creation method is expected to create, update or delete the ITD file as appropriate.
Field Summary | |
---|---|
protected org.springframework.roo.process.manager.FileManager |
fileManager
|
protected org.springframework.roo.metadata.MetadataDependencyRegistry |
metadataDependencyRegistry
|
protected org.springframework.roo.metadata.MetadataService |
metadataService
|
Constructor Summary | |
---|---|
AbstractItdMetadataProvider()
|
Method Summary | |
---|---|
void |
addMetadataTrigger(org.springframework.roo.model.JavaType javaType)
Registers an additional JavaType that will trigger metadata registration. |
protected void |
addProviderRole(ItdProviderRole role)
|
protected abstract String |
createLocalIdentifier(org.springframework.roo.model.JavaType javaType,
org.springframework.roo.project.Path path)
Called whenever there is a requirement to produce a local identifier (ie an instance identifier consistent with MetadataProvider.getProvidesType() ) for the indicated JavaType and Path . |
org.springframework.roo.metadata.MetadataItem |
get(String metadataIdentificationString)
|
protected abstract String |
getGovernorPhysicalTypeIdentifier(String metadataIdentificationString)
Called whenever there is a requirement to convert a local metadata identification string (ie an instance identifier consistent with MetadataProvider.getProvidesType() ) into the corresponding governor physical type identifier. |
String |
getIdForPhysicalJavaType(String physicalJavaTypeIdentifier)
Obtains an identifier that would be validly recognized by this ItdMetadataProvider instance. |
protected abstract ItdTypeDetailsProvidingMetadataItem |
getMetadata(String metadataIdentificationString,
org.springframework.roo.model.JavaType aspectName,
PhysicalTypeMetadata governorPhysicalTypeMetadata,
String itdFilename)
Called when it is time to create the actual metadata instance. |
Set<ItdProviderRole> |
getRoles()
|
protected boolean |
isIgnoreTriggerAnnotations()
|
void |
notify(String upstreamDependency,
String downstreamDependency)
|
void |
removeMetadataTrigger(org.springframework.roo.model.JavaType javaType)
Removes a JavaType metadata trigger registration. |
protected void |
removeProviderRole(ItdProviderRole role)
|
void |
setDependsOnGovernorBeingAClass(boolean dependsOnGovernorBeingAClass)
If set to true (default is true), ensures the governor type details represent a class. |
void |
setDependsOnGovernorTypeDetailAvailability(boolean dependsOnGovernorTypeDetailAvailability)
If set to true (default is true), ensures subclass not called unless the governor type details are available. |
protected void |
setIgnoreTriggerAnnotations(boolean ignoreTriggerAnnotations)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.roo.classpath.itd.ItdMetadataProvider |
---|
getItdUniquenessFilenameSuffix |
Methods inherited from interface org.springframework.roo.metadata.MetadataProvider |
---|
getProvidesType |
Field Detail |
---|
@Reference protected org.springframework.roo.metadata.MetadataDependencyRegistry metadataDependencyRegistry
@Reference protected org.springframework.roo.process.manager.FileManager fileManager
@Reference protected org.springframework.roo.metadata.MetadataService metadataService
Constructor Detail |
---|
public AbstractItdMetadataProvider()
Method Detail |
---|
public final void notify(String upstreamDependency, String downstreamDependency)
notify
in interface org.springframework.roo.metadata.MetadataNotificationListener
protected abstract String createLocalIdentifier(org.springframework.roo.model.JavaType javaType, org.springframework.roo.project.Path path)
MetadataProvider.getProvidesType()
) for the indicated JavaType
and Path
.
javaType
- the type (required)path
- the path (required)
MetadataProvider.getProvidesType()
(never null or empty)protected abstract String getGovernorPhysicalTypeIdentifier(String metadataIdentificationString)
MetadataProvider.getProvidesType()
) into the corresponding governor physical type identifier.
metadataIdentificationString
- the local identifier (required)
protected abstract ItdTypeDetailsProvidingMetadataItem getMetadata(String metadataIdentificationString, org.springframework.roo.model.JavaType aspectName, PhysicalTypeMetadata governorPhysicalTypeMetadata, String itdFilename)
metadataIdentificationString
- the local identifier (non-null and consistent with MetadataProvider.getProvidesType()
)aspectName
- the Java type name for the ITD (non-null and obtained via PhysicalTypeMetadata.getItdJavaType(ItdMetadataProvider)
)governorPhysicalTypeMetadata
- the governor metadata (non-null and obtained via getGovernorPhysicalTypeIdentifier(String)
)itdFilename
- the canonical filename for the ITD (non-null and obtained via PhysicalTypeMetadata.getItdCanoncialPath(ItdMetadataProvider)
)
public void addMetadataTrigger(org.springframework.roo.model.JavaType javaType)
JavaType
that will trigger metadata registration.
addMetadataTrigger
in interface ItdRoleAwareMetadataProvider
javaType
- the type-level annotation to detect that will cause metadata creation (required)public void removeMetadataTrigger(org.springframework.roo.model.JavaType javaType)
JavaType
metadata trigger registration. If the type was never registered, the method returns without an error.
removeMetadataTrigger
in interface ItdRoleAwareMetadataProvider
javaType
- to remove (required)protected final void addProviderRole(ItdProviderRole role)
protected final void removeProviderRole(ItdProviderRole role)
protected boolean isIgnoreTriggerAnnotations()
protected void setIgnoreTriggerAnnotations(boolean ignoreTriggerAnnotations)
public final org.springframework.roo.metadata.MetadataItem get(String metadataIdentificationString)
get
in interface org.springframework.roo.metadata.MetadataProvider
public final String getIdForPhysicalJavaType(String physicalJavaTypeIdentifier)
ItdMetadataProvider
ItdMetadataProvider
instance. The identifier must
represent the presented physical Java type identifier.
The presented physical Java type identifier need not presently exist in the MetadataService
. Implementations must not
rely on the metadata being available at this moment. Implementations by returning a value from this method do not guarantee
that metadata for the returned identifier will subsequently made available. As such this method is a basic conversion method
and shouldn't perform any analysis.
getIdForPhysicalJavaType
in interface ItdMetadataProvider
physicalJavaTypeIdentifier
- to convert into a local metadata identifier (required)
public void setDependsOnGovernorTypeDetailAvailability(boolean dependsOnGovernorTypeDetailAvailability)
dependsOnGovernorTypeDetailAvailability
- true means governor type details must be availablepublic void setDependsOnGovernorBeingAClass(boolean dependsOnGovernorBeingAClass)
setDependsOnGovernorTypeDetailAvailability(boolean)
must also be true to ensure this can be relied upon.
dependsOnGovernorBeingAClass
- true means governor type detail must represent a classpublic final Set<ItdProviderRole> getRoles()
getRoles
in interface ItdRoleAwareMetadataProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |