01: /**
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */package com.tc.util;
04:
05: /**
06: * a thin wrapper around SettableValue to help with [un]boxing boolean values
07: */
08: public class SettableBoolValue extends SettableValue {
09:
10: public SettableBoolValue() {
11: super ();
12: }
13:
14: public void setBool(boolean value) {
15: super .set(new Boolean(value));
16: }
17:
18: /**
19: * @return set value; false otherwise
20: */
21: public boolean boolValue() {
22: return boolValue(false);
23: }
24:
25: /**
26: * @return set value; defaultValue otherwise
27: */
28: public boolean boolValue(boolean defaultValue) {
29: if (isSet()) {
30: Boolean b = (Boolean) value();
31: return b.booleanValue();
32: } else {
33: return defaultValue;
34: }
35: }
36:
37: public Object clone() {
38: SettableBoolValue out = new SettableBoolValue();
39: if (this.isSet())
40: out.set(this.value());
41: return out;
42: }
43:
44: }
|