org.springframework.roo.classpath
Interface TypeLocationService

All Known Implementing Classes:
TypeLocationServiceImpl

public interface TypeLocationService

Locates types.

Since:
1.1
Author:
Alan Stewart, James Tyrrell

Method Summary
 Set<ClassOrInterfaceTypeDetails> findClassesOrInterfaceDetailsWithAnnotation(org.springframework.roo.model.JavaType... annotationsToDetect)
          Returns a set of ClassOrInterfaceTypeDetailss that possess the specified annotations (specified as a vararg).
 Set<ClassOrInterfaceTypeDetails> findClassesOrInterfaceDetailsWithTag(Object tag)
          Returns a set of ClassOrInterfaceTypeDetailss that possess the specified tag.
 Set<org.springframework.roo.model.JavaType> findTypesWithAnnotation(org.springframework.roo.model.JavaType... annotationsToDetect)
          Returns a set of JavaTypes that possess the specified annotations (specified as a vararg).
 Set<org.springframework.roo.model.JavaType> findTypesWithAnnotation(List<org.springframework.roo.model.JavaType> annotationsToDetect)
          Returns a set of JavaTypes that possess the specified list of annotations.
 String getPhysicalTypeCanonicalPath(org.springframework.roo.model.JavaType javaType, org.springframework.roo.project.LogicalPath path)
          Returns the canonical path that the given JavaType would have within the given LogicalPath; this type need not exist.
 String getPhysicalTypeCanonicalPath(String physicalTypeId)
          Returns the canonical path that a type with the given physical type id would have; this type need not exist.
 String getPhysicalTypeIdentifier(org.springframework.roo.model.JavaType javaType)
          Looks for the given JavaType within the user project, and if found, returns the id for its PhysicalTypeMetadata.
 String getPhysicalTypeIdentifier(String fileIdentifier)
          Returns the physical type identifier for the Java source file with the given canonical path.
 List<String> getPotentialTopLevelPackagesForModule(org.springframework.roo.project.maven.Pom module)
           
 String getTopLevelPackageForModule(org.springframework.roo.project.maven.Pom module)
           
 ClassOrInterfaceTypeDetails getTypeDetails(org.springframework.roo.model.JavaType javaType)
          Returns the details of the given Java type from within the user project.
 ClassOrInterfaceTypeDetails getTypeDetails(String physicalTypeId)
          Resolves the ClassOrInterfaceTypeDetails to for the provided physical type identifier.
 org.springframework.roo.project.LogicalPath getTypePath(org.springframework.roo.model.JavaType javaType)
          Returns the LogicalPath containing the given JavaType.
 Collection<org.springframework.roo.model.JavaType> getTypesForModule(org.springframework.roo.project.maven.Pom module)
          Returns the Java types that belong to the given module.
 Collection<String> getTypesForModule(String modulePath)
          Deprecated. use getTypesForModule(Pom) instead; more strongly typed and also ignores any types found in pom-packaged modules
 boolean hasTypeChanged(String requestingClass, org.springframework.roo.model.JavaType javaType)
          Indicates whether the passed in type has changed since last invocation by the requesting class.
 boolean isInProject(org.springframework.roo.model.JavaType javaType)
          Indicates whether the given type exists anywhere in the user project
 void processTypesWithAnnotation(List<org.springframework.roo.model.JavaType> annotationsToDetect, LocatedTypeCallback callback)
          Processes types with the specified list of annotations and uses the supplied callback implementation to process the located types.
 

Method Detail

findClassesOrInterfaceDetailsWithAnnotation

Set<ClassOrInterfaceTypeDetails> findClassesOrInterfaceDetailsWithAnnotation(org.springframework.roo.model.JavaType... annotationsToDetect)
Returns a set of ClassOrInterfaceTypeDetailss that possess the specified annotations (specified as a vararg).

Parameters:
annotationsToDetect - the annotations (as a vararg) to detect on a type.
Returns:
a set of ClassOrInterfaceTypeDetails that have the specified annotations.

findClassesOrInterfaceDetailsWithTag

Set<ClassOrInterfaceTypeDetails> findClassesOrInterfaceDetailsWithTag(Object tag)
Returns a set of ClassOrInterfaceTypeDetailss that possess the specified tag.

Parameters:
tag - the tag to detect on a type.
Returns:
a set of ClassOrInterfaceTypeDetails that have the specified tag.

findTypesWithAnnotation

Set<org.springframework.roo.model.JavaType> findTypesWithAnnotation(org.springframework.roo.model.JavaType... annotationsToDetect)
Returns a set of JavaTypes that possess the specified annotations (specified as a vararg).

Parameters:
annotationsToDetect - the annotations (as a vararg) to detect on a type.
Returns:
a set of types that have the specified annotations.

findTypesWithAnnotation

Set<org.springframework.roo.model.JavaType> findTypesWithAnnotation(List<org.springframework.roo.model.JavaType> annotationsToDetect)
Returns a set of JavaTypes that possess the specified list of annotations.

Parameters:
annotationsToDetect - the list of annotations to detect on a type.
Returns:
a set of types that have the specified annotations.

getPhysicalTypeCanonicalPath

String getPhysicalTypeCanonicalPath(org.springframework.roo.model.JavaType javaType,
                                    org.springframework.roo.project.LogicalPath path)
Returns the canonical path that the given JavaType would have within the given LogicalPath; this type need not exist.

Equivalent to constructing the physical type id from the given arguments and calling getPhysicalTypeCanonicalPath(String).

Parameters:
javaType - the type's JavaType (required)
path - the type's logical path
Returns:
the canonical path (never blank, but might not exist)

getPhysicalTypeCanonicalPath

String getPhysicalTypeCanonicalPath(String physicalTypeId)
Returns the canonical path that a type with the given physical type id would have; this type need not exist.

Parameters:
physicalTypeId - the physical type's metadata id (required)
Returns:
the canonical path (never blank, but might not exist)

getPhysicalTypeIdentifier

String getPhysicalTypeIdentifier(org.springframework.roo.model.JavaType javaType)
Looks for the given JavaType within the user project, and if found, returns the id for its PhysicalTypeMetadata. Use this method if you know that the JavaType exists but don't know its LogicalPath.

This method resolves the issue that a JavaType is location independent, yet PhysicalTypeIdentifier instances are location dependent (i.e. a PhysicalTypeIdentifier relates to a given physical file, whereas a JavaType simply represents a type on the classpath).

Parameters:
javaType - the type to locate (required)
Returns:
the string (in PhysicalTypeIdentifier format) if found, or null if not found

getPhysicalTypeIdentifier

String getPhysicalTypeIdentifier(String fileIdentifier)
Returns the physical type identifier for the Java source file with the given canonical path.

Parameters:
fileIdentifier - the path to the physical type (required)
Returns:
the physical type identifier if the given path matches an existing Java source file, otherwise null

getPotentialTopLevelPackagesForModule

List<String> getPotentialTopLevelPackagesForModule(org.springframework.roo.project.maven.Pom module)
Parameters:
module -
Returns:

getTopLevelPackageForModule

String getTopLevelPackageForModule(org.springframework.roo.project.maven.Pom module)
Parameters:
module -
Returns:

getTypeDetails

ClassOrInterfaceTypeDetails getTypeDetails(org.springframework.roo.model.JavaType javaType)
Returns the details of the given Java type from within the user project.

Parameters:
javaType - the type to look for (required)
Returns:
null if the type doesn't exist in the project

getTypeDetails

ClassOrInterfaceTypeDetails getTypeDetails(String physicalTypeId)
Resolves the ClassOrInterfaceTypeDetails to for the provided physical type identifier. If the physical type identifier doesn't represent a valid type an exception is thrown. This method will return null if the ClassOrInterfaceTypeDetails can't be found.

Parameters:
physicalTypeId - the physical type metadata id (can be blank)
Returns:
the resolved ClassOrInterfaceTypeDetails, or null if the details can't be found (e.g. the given ID is blank)

getTypePath

org.springframework.roo.project.LogicalPath getTypePath(org.springframework.roo.model.JavaType javaType)
Returns the LogicalPath containing the given JavaType.

Parameters:
javaType - the JavaType for which to return the LogicalPath
Returns:
null if that type doesn't exist in the project

getTypesForModule

Collection<org.springframework.roo.model.JavaType> getTypesForModule(org.springframework.roo.project.maven.Pom module)
Returns the Java types that belong to the given module.

Parameters:
module -
Returns:
a non-null collection
Since:
1.2.1

getTypesForModule

@Deprecated
Collection<String> getTypesForModule(String modulePath)
Deprecated. use getTypesForModule(Pom) instead; more strongly typed and also ignores any types found in pom-packaged modules

Returns the Java types that belong to the given module.

Parameters:
modulePath -
Returns:
a non-null collection of fully-qualified type names

hasTypeChanged

boolean hasTypeChanged(String requestingClass,
                       org.springframework.roo.model.JavaType javaType)
Indicates whether the passed in type has changed since last invocation by the requesting class.

Parameters:
requestingClass - the class requesting the changed types
javaType - the type to lookup to see if a change has occurred
Returns:
a collection of MIDs which represent changed types

isInProject

boolean isInProject(org.springframework.roo.model.JavaType javaType)
Indicates whether the given type exists anywhere in the user project

Parameters:
javaType - the type to check for (can be null)
Returns:
false if a null type is given

processTypesWithAnnotation

void processTypesWithAnnotation(List<org.springframework.roo.model.JavaType> annotationsToDetect,
                                LocatedTypeCallback callback)
Processes types with the specified list of annotations and uses the supplied callback implementation to process the located types.

Parameters:
annotationsToDetect - the list of annotations to detect on a type.
callback - the LocatedTypeCallback to handle the processing of the located type


Copyright © 2009–2015. All rights reserved.