KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > regis > Property


1 package org.sapia.regis;
2
3 import java.util.List JavaDoc;
4
5 import org.sapia.regis.type.BuiltinType;
6
7 /**
8  * Models a configuration property.
9  *
10  * @author yduchesne
11  */

12 public interface Property{
13   
14   /**
15    * @return this instance's value, or <code>null</code>
16    * if no such value exists.
17    */

18   public String JavaDoc getValue();
19   
20   /**
21    * @return this instance's key.
22    */

23   public String JavaDoc getKey();
24   
25   /**
26    * @return <code>true</code> if this instance has no value.
27    */

28   public boolean isNull();
29   
30   /**
31    * @return this instance's string value.
32    * @throws IllegalStateException if this instance has no value.
33    * @see #isNull()
34    */

35   public String JavaDoc asString();
36   
37   /**
38    * @return this instance's integer value.
39    * @throws IllegalStateException if this instance has no value.
40    * @throws NumberFormatException if this instance could not be
41    * converted to an integer.
42    * @see #isNull()
43    */

44   public int asInt();
45   
46   /**
47    * @return this instance's long value.
48    * @throws IllegalStateException if this instance has no value.
49    * @throws NumberFormatException if this instance could not be
50    * converted to a long.
51    * @see #isNull()
52    */

53   public long asLong();
54   
55   /**
56    * @return this instance's float value.
57    * @throws IllegalStateException if this instance has no value.
58    * @throws NumberFormatException if this instance could not be
59    * converted to a float.
60    * @see #isNull()
61    */

62   public float asFloat();
63   
64   /**
65    * @return this instance's double value.
66    * @throws IllegalStateException if this instance has no value.
67    * @throws NumberFormatException if this instance could not be
68    * converted to a double.
69    * @see #isNull()
70    */

71   public double asDouble();
72   
73   /**
74    * @return <code>true</code> if this instance's value corresponds
75    * to <code>on</code>, <code>yes</code>, or <code>true</code> -
76    * internal comparison is case-insensitive.
77    *
78    * @throws IllegalStateException if this instance has no value.
79    * @see #isNull()
80    */

81   public boolean asBoolean();
82   
83   /**
84    * @return the <code>List</code> of <code>String</code> values held in this
85    * property.
86    *
87    * @see #asList(BuiltinType)
88    */

89   public List JavaDoc asList();
90
91   /**
92    * @return the <code>List</code> of values held in this property (in fact, the value
93    * is expected to be a comma-delimited list of values).
94    */

95   
96   public List JavaDoc asList(BuiltinType type);
97
98 }
99
Popular Tags