1 /* 2 * This file is part of Pease Plate Template Engine. 3 * 4 * Pease Plate Template Engine is free software: you can redistribute 5 * it and/or modify it under the terms of the GNU Lesser General 6 * Public License as published by the Free Software Foundation, 7 * either version 3 of the License, or any later version. 8 * 9 * Pease Plate Template Engine is distributed in the hope that it 10 * will be useful, but WITHOUT ANY WARRANTY; without even the implied 11 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 * See the GNU Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with Pease Plate Template Engine. If not, see 16 * <http://www.gnu.org/licenses/>. 17 * 18 * Copyright (c) 2008 Manfred HANTSCHEL 19 */ 20 package org.peaseplate.internal; 21 22 import org.peaseplate.Messages; 23 import org.peaseplate.RenderContext; 24 import org.peaseplate.internal.template.MacroReference; 25 26 /** 27 * The context for building a template from chunks. 28 * 29 * @author Manfred HANTSCHEL 30 */ 31 public interface BuildContext extends RenderContext { 32 33 /** 34 * Pushes the working object to the stack 35 * 36 * @param object the working object 37 */ 38 public void pushWorkingObject(Object object); 39 40 /** 41 * Pops the working object from the stack 42 * 43 * @return the working object 44 * @throws IllegalStateException if there is no working object on the stack 45 */ 46 public Object popWorkingObject() throws IllegalStateException; 47 48 /** 49 * Gets the top most working object from the stack without popping it 50 * 51 * @return the working object 52 * @throws IllegalStateException if there is no working object on the stack 53 */ 54 public Object getWorkingObject() throws IllegalStateException; 55 56 /** 57 * Pushes the messages to the stack 58 * 59 * @param messages the messages 60 */ 61 public void pushMessages(Messages messages); 62 63 /** 64 * Pops the messages from the stack 65 * 66 * @return the messages 67 * @throws IllegalStateException if there is no messages object on the stack 68 */ 69 public Messages popMessages() throws IllegalStateException; 70 71 /** 72 * Returns the current messages object from the stack 73 * 74 * @return the top most messages object 75 * @throws IllegalStateException if there is no messages object on the stack 76 */ 77 public Messages getMessages() throws IllegalStateException; 78 79 /** 80 * Returns the macro reference with the specified name 81 * and the specified extension 82 * @param qualifiedName the qualifiedName of the macro 83 * @return the macro reference or null if not found 84 */ 85 public MacroReference getMacroReference(String qualifiedName); 86 87 /** 88 * Sets the variable with the specified name 89 * @param name the name of the variable 90 * @param value the value of the variable 91 */ 92 public void setVariable(String name, Object value); 93 94 /** 95 * Returns the variable with the specified name 96 * or null if not set 97 * @param name the name 98 * @return the variable or null if not set 99 */ 100 public Object getVariable(String name); 101 102 /** 103 * Releases the variable with the specified name 104 * @param name the name of the variable 105 */ 106 public void releaseVariable(String name); 107 108 }