@UsesConfiguration(value=LibraryMapping.class) public interface ComponentClassResolver
LibraryMapping
s. Each mapping maps a prefix, such as "core"
to a root package name, such as "org.apache.tapestry5.corelib". The root package is expected to have sub-packages:
"pages", "components", "mixins" and "base" ("base" is for base classes).
The resolver performs a search of the classpath (via ClassNameLocator
), to build up a set of case-insensitive
maps from logical page name, component type, or mixin type to fully qualified class name.
Certain ambiguities occur if mapped packages overlap, either in terms of the the prefixes or the package names. Keep
things clearly separate to avoid lookup problems.Modifier and Type | Method and Description |
---|---|
String |
canonicalizePageName(String pageName)
Returns the canonical form of a page name.
|
List<String> |
getComponentNames()
Returns a list of all component names, in sorted order.
|
Map<String,ControlledPackageType> |
getControlledPackageMapping()
Used to identify which packages are controlled packages (from which components are loaded).
|
Map<String,String> |
getFolderToPackageMapping()
A mapping from virtual folder name to a package name (used for converting classpath
Asset s
to client URLs). |
Collection<LibraryMapping> |
getLibraryMappings()
Returns the library mappings.
|
String |
getLibraryNameForClass(String className)
Given a class name of a component class, returns the library name (as defined by a
contributed library name).
|
List<String> |
getLibraryNames()
Returns the names of all libraries (as configured).
|
List<String> |
getMixinNames()
Returns a list of all mixin names, in sorted order.
|
List<String> |
getPageNames()
Returns a list of all page names, in sorted order.
|
boolean |
isPage(String pageClassName)
Returns true if the class name is specifically a page class, and not a component, mixin or base class.
|
boolean |
isPageName(String pageName)
For a particular path, determines if the path is a logical page name.
|
String |
resolveComponentTypeToClassName(String componentType)
Converts a component type (a logical component name such as might be used inside a template or annotation) into a
fully qualified class name.
|
String |
resolveMixinTypeToClassName(String mixinType)
Converts a logical mixin type (as with component types) into a fully qualified class name.
|
String |
resolvePageClassNameToPageName(String pageClassName)
Converts a fully qualified page class name into a page name (often, for inclusion as part of the URI).
|
String |
resolvePageNameToClassName(String pageName)
Converts a logical page name (such as might be encoded into a URL) into a fully qualified class name.
|
String resolvePageNameToClassName(String pageName)
pageName
- page nameUnknownValueException
- if the name does not match a known page classboolean isPageName(String pageName)
pageName
- potential logical page nameList<String> getPageNames()
@IncompatibleChange(release="5.4", details="added method") List<String> getComponentNames()
@IncompatibleChange(release="5.4", details="added method") List<String> getMixinNames()
String resolvePageClassNameToPageName(String pageClassName)
resolvePageNameToClassName(String)
.pageClassName
- fully qualified name of a page classIllegalArgumentException
- if the name can not be resolvedString canonicalizePageName(String pageName)
UnknownValueException
- if the page name does not match a logical page nameString resolveComponentTypeToClassName(String componentType)
componentType
- a logical component typeUnknownValueException
- if the component type can not be resolvedString resolveMixinTypeToClassName(String mixinType)
mixinType
- a logical mixin typeUnknownValueException
- if the mixin type can not be resolvedMap<String,String> getFolderToPackageMapping()
Asset
s
to client URLs). This is derived from the contributed LibraryMapping
s.
It is allowed to contribute multiple root packages as a single folder name. In this case, the best common package
name is used. For example, if both com.example.main
and com.example.extras
is mapped to
folder "example", then the package mapping for "example" will be com.example
.ClasspathAssetAliasManager
List<String> getLibraryNames()
Map<String,ControlledPackageType> getControlledPackageMapping()
ControlledPackageType
.boolean isPage(String pageClassName)
pageClassName
- String getLibraryNameForClass(String className)
className
- IllegalArgumentException
- if the class can't be matched to a contributed root package@IncompatibleChange(release="5.4", details="Added method") Collection<LibraryMapping> getLibraryMappings()
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.