KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > validate > StringPropertyId


1 package com.thaiopensource.validate;
2
3 import com.thaiopensource.util.PropertyId;
4 import com.thaiopensource.util.PropertyMap;
5 import com.thaiopensource.util.PropertyMapBuilder;
6
7 /**
8  * A PropertyId whose value is constrained to be an instance of
9  * String.
10  *
11  * @see String
12  */

13
14 public class StringPropertyId extends PropertyId {
15    public StringPropertyId(String JavaDoc name) {
16       super(name, String JavaDoc.class);
17     }
18
19   /**
20    * Returns the value of the property. This is a typesafe
21    * version of <code>PropertyMap.get</code>.
22    *
23    * @param properties the PropertyMap to be used
24    * @return the String to which the PropertyMap maps this PropertyId,
25    * or <code>null</code> if this PropertyId is not in the PropertyMap
26    * @see com.thaiopensource.util.PropertyMap#get
27    */

28   public String JavaDoc get(PropertyMap properties) {
29     return (String JavaDoc)properties.get(this);
30   }
31
32   /**
33    * Sets the value of the property. Modifies the PropertyMapBuilder
34    * so that this PropertyId is mapped to the specified value. This
35    * is a typesafe version of PropertyMapBuilder.put.
36    *
37    * @param builder the PropertyMapBuilder to be modified
38    * @param value the String to which this PropertyId is to be mapped
39    * @return the String to which this PropertyId was mapped before,
40    * or <code>null</code> if it was not mapped
41    *
42    * @see com.thaiopensource.util.PropertyMapBuilder#put
43    */

44   public String JavaDoc put(PropertyMapBuilder builder, String JavaDoc value) {
45     return (String JavaDoc)builder.put(this, value);
46   }
47 }
48
Popular Tags