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: PropertyValueObject.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.ioc;
09:
10: /**
11: * Holds a single static object property value that doesn't change at runtime.
12: *
13: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
14: * @version $Revision: 3634 $
15: * @since 1.0
16: */
17: import com.uwyn.rife.ioc.PropertyValue;
18:
19: public class PropertyValueObject implements PropertyValue {
20: private Object mValue = null;
21:
22: /**
23: * The constructor that stores the static object instance.
24: *
25: * @param value the static object instance
26: * @since 1.0
27: */
28: public PropertyValueObject(Object value) {
29: mValue = value;
30: }
31:
32: public Object getValue() {
33: return mValue;
34: }
35:
36: public String getValueString() {
37: return String.valueOf(mValue);
38: }
39:
40: public String toString() {
41: return getValueString();
42: }
43:
44: public boolean isNeglectable() {
45: if (null == mValue) {
46: return true;
47: }
48:
49: return 0 == String.valueOf(mValue).trim().length();
50: }
51:
52: public boolean isStatic() {
53: return true;
54: }
55: }
|