KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > util > text > SystemContext


1 package org.sapia.util.text;
2
3
4 /**
5  * A <code>TemplateContextIF<code> that resolves values using the system
6  * properties.
7  *
8  * @author JC Desrochers
9  *
10  * <dl>
11  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
12  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
13  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
14  * </dl>
15  */

16 public class SystemContext implements TemplateContextIF {
17   /**
18    * Returns the value of this context for the property name passed in.
19    *
20    * @param aName The name of the property.
21    */

22   public Object JavaDoc getValue(String JavaDoc aName) {
23     return System.getProperty(aName);
24   }
25
26   /**
27    * @see org.sapia.util.text.TemplateContextIF#put(String, Object)
28    */

29   public void put(String JavaDoc name, Object JavaDoc value) {
30     System.setProperty(name, (value == null) ? null : value.toString());
31   }
32 }
33
Popular Tags