1 package org.apache.fulcrum.template; 2 3 56 57 import java.util.HashMap ; 58 59 81 public class DefaultTemplateContext 82 implements TemplateContext 83 { 84 TemplateContext innerContext; 85 86 89 private HashMap context = new HashMap (); 90 91 95 public DefaultTemplateContext() 96 { 97 } 98 99 102 public DefaultTemplateContext(TemplateContext context) 103 { 104 super(); 105 106 112 Object [] keys = context.getKeys(); 113 114 for (int i = 0; i < keys.length; i++) 115 { 116 put((String ) keys[i], context.get((String )keys[i])); 117 } 118 } 119 120 public void put(String key, Object value) 121 { 122 context.put(key, value); 123 } 124 125 public Object get(String key) 126 { 127 return context.get(key); 128 } 129 130 public Object remove(Object key) 131 { 132 return context.remove(key); 133 } 134 135 public boolean containsKey(Object key) 136 { 137 return context.containsKey(key); 138 } 139 140 public Object [] getKeys() 141 { 142 return context.keySet().toArray(); 143 } 144 } 145 146 | Popular Tags |