001// Licensed under the Apache License, Version 2.0 (the "License"); 002// you may not use this file except in compliance with the License. 003// You may obtain a copy of the License at 004// 005// http://www.apache.org/licenses/LICENSE-2.0 006// 007// Unless required by applicable law or agreed to in writing, software 008// distributed under the License is distributed on an "AS IS" BASIS, 009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 010// See the License for the specific language governing permissions and 011// limitations under the License. 012 013package org.apache.tapestry5.internal.parser; 014 015import java.util.List; 016import java.util.Map; 017import java.util.Set; 018 019import org.apache.tapestry5.commons.Location; 020import org.apache.tapestry5.commons.Resource; 021 022/** 023 * A parsed component template, containing all the tokens parsed from the template. 024 */ 025public interface ComponentTemplate 026{ 027 /** 028 * Returns true if no template could be found for the component. 029 */ 030 boolean isMissing(); 031 032 /** 033 * Returns true if this component template is an extension of its parent class' template. 034 * 035 * @since 5.1.0.1 036 */ 037 boolean isExtension(); 038 039 /** 040 * Indicates whether lax (the old default) or strict (the new default) mixin parameters are used. 041 * In strict mode, introduced with the 5.4 template DTD, mixin parameters must be qualified with the mixin name. 042 * In prior releases, Tapestry would attempt a search for a fit, and this causes ambiguities 043 * that can't be addressed. 044 * 045 * @since 5.4 046 * @return true if a 5.4 or later DTD 047 */ 048 boolean usesStrictMixinParameters(); 049 050 /** 051 * Returns a list of tokens associated with an extension point, or null if this template neither defines the 052 * extension point nor overrides it. 053 * 054 * @param extensionPointId 055 * @return list of tokens provided in this template, or null 056 * @since 5.1.0.1 057 */ 058 List<TemplateToken> getExtensionPointTokens(String extensionPointId); 059 060 /** 061 * Returns the extension point ids, including both <t:extension-point> 062 * and <t:replace>. 063 * @return set of extension point ids. 064 * @since 5.8.5 065 */ 066 Set<String> getExtensionPointIds(); 067 068 /** 069 * Returns the resource that was parsed to form the template. 070 */ 071 Resource getResource(); 072 073 /** 074 * Returns a list of tokens that were parsed from the template. The caller should not modify this list. 075 */ 076 List<TemplateToken> getTokens(); 077 078 /** 079 * Identifies {@link org.apache.tapestry5.internal.parser.StartComponentToken}s with a non-blank id, mapping the 080 * id to its location (within the template). This is used to report unmatched ids (where the component, or its 081 * super-classes, do not define an embedded component). 082 * 083 * @see org.apache.tapestry5.annotations.Component (used to define an embedded component) 084 */ 085 Map<String, Location> getComponentIds(); 086}