org.springframework.roo.project
Interface PathResolver

All Known Implementing Classes:
AbstractPathResolver

public interface PathResolver

Allows resolution between File, Path and canonical path Strings.

Add-ons should use this class as their primary mechanism to resolve paths in order to maximize future compatibility with any design refactoring, project structural enhancements or alternate build systems. Add-ons should generally avoid using File directly.

Since:
1.0
Author:
Ben Alex

Method Summary
 String getFriendlyName(String identifier)
          Converts the presented canonical path into a human-friendly name.
 String getIdentifier(Path path, String relativePath)
          Produces a canonical path for the presented Path and relative path.
 List<Path> getNonSourcePaths()
          Similar to getSourcePaths(), but only returns Paths which are not compiled.
 Path getPath(String identifier)
          Attempts to determine which Path the specified canonical path falls under.
 List<Path> getPaths()
          Returns all paths supported by the implementation, in an order defined by the implementation.
 String getRelativeSegment(String identifier)
          Attempts to determine which Path the specified canonical path falls under, and then returns the relative portion of the file name.
 String getRoot(Path path)
          Returns a canonical path that represents the root of the presented Path.
 List<Path> getSourcePaths()
          Indicates all the source code Paths known to this PathResolver.
 

Method Detail

getIdentifier

String getIdentifier(Path path,
                     String relativePath)
Produces a canonical path for the presented Path and relative path.

Parameters:
path - to use (required)
relativePath - to use (cannot be null, but may be empty if referring to the path itself)
Returns:
the canonical path to the file (never null)

getPath

Path getPath(String identifier)
Attempts to determine which Path the specified canonical path falls under.

Parameters:
identifier - to lookup (required)
Returns:
the Path, or null if the identifier refers to a location not under a know path.

getRoot

String getRoot(Path path)
Returns a canonical path that represents the root of the presented Path.

Parameters:
path - to lookup (required)
Returns:
the root of the path (never null or empty)

getRelativeSegment

String getRelativeSegment(String identifier)
Attempts to determine which Path the specified canonical path falls under, and then returns the relative portion of the file name.

See FileDetails.getRelativeSegment(String) for related information.

Parameters:
identifier - to resolve (required)
Returns:
the relative segment (which may be an empty string if the identifier referred to the Path directly), or null if the identifier does not have a corresponding Path

getFriendlyName

String getFriendlyName(String identifier)
Converts the presented canonical path into a human-friendly name.

Parameters:
identifier - to resolve (required)
Returns:
a human-friendly name for the identifier (required)

getSourcePaths

List<Path> getSourcePaths()
Indicates all the source code Paths known to this PathResolver.

Whilst generally add-ons should know which paths contain source and which do not, this method abstracts add-ons from direct knowledge of available paths.

By default this method will return, in the following order:

Returns:
the paths, in order of compilation priority (never null and never empty)

getNonSourcePaths

List<Path> getNonSourcePaths()
Similar to getSourcePaths(), but only returns Paths which are not compiled.

By default this method will return, in the following order:

Returns:
the paths which are not compiled, in an order defined by the implementation (never null and never empty).

getPaths

List<Path> getPaths()
Returns all paths supported by the implementation, in an order defined by the implementation.

By default this method will return, in the following order:

Returns:
all supported paths (never null and never empty)


Copyright © 2009-2010 VMware, Inc. All Rights Reserved.