Procedure — Creating a New BreadCrumbDelegate Class
Creating the BreadCrumbDelegate Class
Breadcrumb delegate classes should implement the BreadCrumbDelegate interface. This interface has two methods: canHandle() and getGenerator().
The canHandle() method is called by the respective delegate factory to determine if the delegate’s inner AbstractBreadCrumbGenerator class (see below) is capable of producing breadcrumbs for a given page. The canHandle() method is passed the page URL, the context object from the URL, if any, and the container object from the URL, if any. It should return true or false.
Respective controller uses the getGenerator() method of the delegate chosen by the factory to get a new instance of its inner AbstractBreadCrumbGenerator class.
* 
Since the factory creates only one static instance of each delegate, the delegate class itself should not use class instance variables or be stateful in any way.
Creating the AbstractBreadCrumbGenerator Inner Class
Your delegate class should have an inner class that is a subclass of AbstractBreadCrumbGenerator. The getBreadCrumbs() method of the inner class will be called by the BreadCrumbController to generate the BreadCrumbArray of crumbs. A new instance of the inner generator class will be created each time it is called so generator classes may be stateful.
The constructor of the generator class will be passed to the URL of the page, the context object for the page, if given on the URL, and the container for the page, if given on the URL. Use the supported API to build BreadCrumbArray to return it.
For example classes, see Sample Code.
這是否有幫助?