1 |
/* java.beans.Expression |
/* java.beans.Expression |
2 |
Copyright (C) 2004 Free Software Foundation, Inc. |
Copyright (C) 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
51 |
{ |
{ |
52 |
// This is a placeholder to indicate that value hasn't been set |
// This is a placeholder to indicate that value hasn't been set |
53 |
// yet; |
// yet; |
54 |
private static final Object unset = new Object(); |
private static final Object UNSET = new Object(); |
55 |
|
|
56 |
// The value to return. This is equal to unset until getValue is called. |
// The value to return. This is equal to unset until getValue is called. |
57 |
private Object value; |
private Object value; |
89 |
public Expression(Object target, String methodName, Object[] arguments) |
public Expression(Object target, String methodName, Object[] arguments) |
90 |
{ |
{ |
91 |
super(target, methodName, arguments); |
super(target, methodName, arguments); |
92 |
this.value = unset; |
this.value = UNSET; |
93 |
} |
} |
94 |
|
|
95 |
/** |
/** |
105 |
*/ |
*/ |
106 |
public Object getValue() throws Exception |
public Object getValue() throws Exception |
107 |
{ |
{ |
108 |
if (value == unset) |
if (value == UNSET) |
109 |
value = doExecute(); |
value = doExecute(); |
110 |
return value; |
return value; |
111 |
} |
} |
126 |
public String toString() |
public String toString() |
127 |
{ |
{ |
128 |
String result = super.toString(); |
String result = super.toString(); |
129 |
if (value != unset) |
if (value != UNSET) |
130 |
return value.getClass().getName() + " " + result; |
return value.getClass().getName() + " " + result; |
131 |
return result; |
return result; |
132 |
} |
} |