001 // Copyright 2004, 2005 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.tapestry.parse; 016 017 import java.util.Map; 018 019 import org.apache.hivemind.Location; 020 021 /** 022 * A Factory used by {@link org.apache.tapestry.parse.TemplateParser} to create 023 * {@link org.apache.tapestry.parse.TemplateToken} objects. 024 * 025 * <p> 026 * This class is extended by Spindle - the Eclipse Plugin for Tapestry. 027 * <p> 028 * @author glongman@intelligentworks.com 029 * @since 3.0 030 */ 031 public class TemplateTokenFactory 032 { 033 public OpenToken createOpenToken(String tagName, String jwcId, String type, Location location) 034 { 035 return new OpenToken(tagName, jwcId, type, location); 036 } 037 038 public CloseToken createCloseToken(String tagName, Location location) 039 { 040 return new CloseToken(tagName, location); 041 } 042 043 public TextToken createTextToken( 044 char[] templateData, 045 int blockStart, 046 int end, 047 Location templateLocation) 048 { 049 return new TextToken(templateData, blockStart, end, templateLocation); 050 } 051 052 public LocalizationToken createLocalizationToken( 053 String tagName, 054 String localizationKey, 055 boolean raw, 056 Map attributes, 057 Location startLocation) 058 { 059 return new LocalizationToken(tagName, localizationKey, raw, attributes, startLocation); 060 } 061 }