Class ComponentClassResolverImpl
-
- org.apache.tapestry5.internal.services.ComponentClassResolverImpl
-
- All Implemented Interfaces:
InvalidationListener
,ComponentClassResolver
public class ComponentClassResolverImpl extends implements ComponentClassResolver, InvalidationListener
-
-
Constructor Summary
Constructors Constructor Description ComponentClassResolverImpl(org.slf4j.Logger logger, ClassNameLocator classNameLocator, startPageName, <LibraryMapping> mappings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description pageName)
Returns the canonical form of a page name.<>
getComponentNames()
Returns a list of all component names, in sorted order.<,ControlledPackageType>
getControlledPackageMapping()
Used to identify which packages are controlled packages (from which components are loaded).<,>
getFolderToPackageMapping()
A mapping from virtual folder name to a package name (used for converting classpathAsset
s to client URLs).<LibraryMapping>
getLibraryMappings()
Returns the library mappings.className)
Given a class name of a component class, returns the library name (as defined by a contributed library name).<>
getLibraryNames()
Returns the names of all libraries (as configured).<>
getMixinNames()
Returns a list of all mixin names, in sorted order.<>
getPageNames()
Returns a list of all page names, in sorted order.boolean
pageClassName)
Returns true if the class name is specifically a page class, and not a component, mixin or base class.boolean
pageName)
For a particular path, determines if the path is a logical page name.void
objectWasInvalidated()
When the class loader is invalidated, clear any cached page names or component types.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.mixinType)
Converts a logical mixin type (as with component types) into a fully qualified class name.pageClassName)
Converts a fully qualified page class name into a page name (often, for inclusion as part of the URI).pageName)
Converts a logical page name (such as might be encoded into a URL) into a fully qualified class name.
-
-
-
Constructor Detail
-
ComponentClassResolverImpl
public ComponentClassResolverImpl(org.slf4j.Logger logger, ClassNameLocator classNameLocator, @Symbol("tapestry.start-page-name") startPageName, <LibraryMapping> mappings)
-
-
Method Detail
-
getControlledPackageMapping
public <,ControlledPackageType> getControlledPackageMapping()
Description copied from interface:ComponentClassResolver
Used to identify which packages are controlled packages (from which components are loaded). Future expansion may allow for additional packages which are live reloaded but not components (or perhaps are transformed, but not as components).- Specified by:
getControlledPackageMapping
in interfaceComponentClassResolver
- Returns:
- a mapping from package name to
ControlledPackageType
.
-
objectWasInvalidated
public void objectWasInvalidated()
When the class loader is invalidated, clear any cached page names or component types.- Specified by:
objectWasInvalidated
in interfaceInvalidationListener
-
resolvePageNameToClassName
public pageName)
Description copied from interface:ComponentClassResolver
Converts a logical page name (such as might be encoded into a URL) into a fully qualified class name. The case of the page name is irrelevant.- Specified by:
resolvePageNameToClassName
in interfaceComponentClassResolver
- Parameters:
pageName
- page name- Returns:
- fully qualified class name for the page
-
isPageName
public boolean pageName)
Description copied from interface:ComponentClassResolver
For a particular path, determines if the path is a logical page name. The check is case insensitive.- Specified by:
isPageName
in interfaceComponentClassResolver
- Parameters:
pageName
- potential logical page name- Returns:
- true if the page name is valid
-
isPage
public boolean pageClassName)
Description copied from interface:ComponentClassResolver
Returns true if the class name is specifically a page class, and not a component, mixin or base class.- Specified by:
isPage
in interfaceComponentClassResolver
- Returns:
- true if a page class
-
getPageNames
public <> getPageNames()
Description copied from interface:ComponentClassResolver
Returns a list of all page names, in sorted order. These are the "canonical" page names.- Specified by:
getPageNames
in interfaceComponentClassResolver
-
getComponentNames
public <> getComponentNames()
Description copied from interface:ComponentClassResolver
Returns a list of all component names, in sorted order. These are the "canonical" component names.- Specified by:
getComponentNames
in interfaceComponentClassResolver
-
getMixinNames
public <> getMixinNames()
Description copied from interface:ComponentClassResolver
Returns a list of all mixin names, in sorted order. These are the "canonical" mixin names.- Specified by:
getMixinNames
in interfaceComponentClassResolver
-
resolveComponentTypeToClassName
public componentType)
Description copied from interface:ComponentClassResolver
Converts a component type (a logical component name such as might be used inside a template or annotation) into a fully qualified class name. Case is ignored in resolving the name.- Specified by:
resolveComponentTypeToClassName
in interfaceComponentClassResolver
- Parameters:
componentType
- a logical component type- Returns:
- fully qualified class name
-
resolveMixinTypeToClassName
public mixinType)
Description copied from interface:ComponentClassResolver
Converts a logical mixin type (as with component types) into a fully qualified class name. Case is ignored when resolving the name.- Specified by:
resolveMixinTypeToClassName
in interfaceComponentClassResolver
- Parameters:
mixinType
- a logical mixin type- Returns:
- fully qualified class name
-
resolvePageClassNameToPageName
public pageClassName)
Description copied from interface:ComponentClassResolver
Converts a fully qualified page class name into a page name (often, for inclusion as part of the URI). This value may later be passed toComponentClassResolver.resolvePageNameToClassName(String)
.- Specified by:
resolvePageClassNameToPageName
in interfaceComponentClassResolver
- Parameters:
pageClassName
- fully qualified name of a page class- Returns:
- equivalent logical page name
-
canonicalizePageName
public pageName)
Description copied from interface:ComponentClassResolver
Returns the canonical form of a page name. The canonical form uses character case matching the underlying class name.- Specified by:
canonicalizePageName
in interfaceComponentClassResolver
-
getFolderToPackageMapping
public <,> getFolderToPackageMapping()
Description copied from interface:ComponentClassResolver
A mapping from virtual folder name to a package name (used for converting classpathAsset
s to client URLs). This is derived from the contributedLibraryMapping
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 bothcom.example.main
andcom.example.extras
is mapped to folder "example", then the package mapping for "example" will becom.example
.- Specified by:
getFolderToPackageMapping
in interfaceComponentClassResolver
- See Also:
ClasspathAssetAliasManager
-
getLibraryNames
public <> getLibraryNames()
Description copied from interface:ComponentClassResolver
Returns the names of all libraries (as configured). This does not include the application itself (which is a library with the virtual path of empty string).- Specified by:
getLibraryNames
in interfaceComponentClassResolver
- Returns:
- sorted names of libraries
-
getLibraryNameForClass
public className)
Description copied from interface:ComponentClassResolver
Given a class name of a component class, returns the library name (as defined by a contributed library name).- Specified by:
getLibraryNameForClass
in interfaceComponentClassResolver
- Returns:
- library name
-
getLibraryMappings
public <LibraryMapping> getLibraryMappings()
Description copied from interface:ComponentClassResolver
Returns the library mappings.- Specified by:
getLibraryMappings
in interfaceComponentClassResolver
- Returns:
-
-