001    // Copyright 2006, 2008, 2009 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry5.internal.parser;
016    
017    import org.apache.tapestry5.ioc.Location;
018    import org.apache.tapestry5.ioc.Resource;
019    
020    import java.util.List;
021    import java.util.Map;
022    
023    /**
024     * A parsed component template, containing all the tokens parsed from the template.
025     */
026    public interface ComponentTemplate
027    {
028        /**
029         * Returns true if no template could be found for the component.
030         */
031        boolean isMissing();
032    
033        /**
034         * Returns true if this component template is an extension of its parent class' template.
035         *
036         * @since 5.1.0.1
037         */
038        boolean isExtension();
039    
040        /**
041         * Returns a list of tokens associated with an extension point, or null if this template neither defines the
042         * extension point nor overrides it.
043         *
044         * @param extensionPointId
045         * @return list of tokens provided in this template, or null
046         * @since 5.1.0.1
047         */
048        List<TemplateToken> getExtensionPointTokens(String extensionPointId);
049    
050        /**
051         * Returns the resource that was parsed to form the template.
052         */
053        Resource getResource();
054    
055        /**
056         * Returns a list of tokens that were parsed from the template. The caller should not modify this list.
057         */
058        List<TemplateToken> getTokens();
059    
060        /**
061         * Identifies     {@link org.apache.tapestry5.internal.parser.StartComponentToken}s with a non-blank id, mapping the
062         * id to its location (within the template). This is used to report unmatched ids (where the component, or its
063         * super-classes, do not define an embedded component).
064         *
065         * @see org.apache.tapestry5.annotations.Component (used to define an embedded component)
066         */
067        Map<String, Location> getComponentIds();
068    }