01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: PropertyValue.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.ioc;
09:
10: import com.uwyn.rife.ioc.exceptions.PropertyValueException;
11:
12: /**
13: * This interface defines the methods that need to be implemented by classes
14: * that are able to provide values to properties.
15: * <p>These classes should make all value retrieval as lazy as possible and
16: * store only the parameters that are required to obtain the actual data
17: * dynamically at runtime.
18: *
19: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
20: * @version $Revision: 3634 $
21: * @since 1.0
22: */
23: public interface PropertyValue {
24: /**
25: * Retrieves a property value.
26: *
27: * @return the requested property value; or
28: * <p><code>null</code> if the property value couldn't be found
29: * @exception PropertyValueException When something went wrong during the
30: * retrieval of the property value.
31: * @since 1.0
32: */
33: public Object getValue() throws PropertyValueException;
34:
35: /**
36: * Retrieves a string representation of the property value.
37: *
38: * @return the requested string representation of the property value; or
39: * <p><code>null</code> if the property value couldn't be found
40: * @exception PropertyValueException When something went wrong during the
41: * retrieval of the property value.
42: * @since 1.0
43: */
44: public String getValueString() throws PropertyValueException;
45:
46: /**
47: * Indicates whether the value provided by this instance is neglectable in
48: * a textual context. This is for instance applicable to pure whitespace
49: * values that when trimmed, have zero length. The property construction
50: * logic will check this state to determine if it has to concatenate
51: * several property values together as one text result of only use one and
52: * discard all other neglectable ones.
53: *
54: * @return <code>true</code> if the value is neglectable in a textual
55: * context; or
56: * <p><code>false</code> otherwise
57: * @since 1.0
58: */
59: public boolean isNeglectable();
60:
61: /**
62: * Indicates whether the value is statically fixed an not dynamically
63: * retrieved at runtime.
64: *
65: * @return <code>true</code> if the value is static; or
66: * <p><code>false</code> if the value is dynamically retrieved at runtime
67: * @since 1.0
68: */
69: public boolean isStatic();
70: }
|