01: package org.gui4j.core.call;
02:
03: import java.util.Map;
04:
05: import org.gui4j.exception.Gui4jUncheckedException;
06:
07: final class Gui4jAccessBoolean extends Gui4jAccessImpl {
08: private final Boolean mValue;
09:
10: Gui4jAccessBoolean(ParseCtx parseCtx, String accessPath) {
11: int startIndex = parseCtx.i;
12: startIndex++; // accessPath.charAt(startIndex)='~'
13: if (startIndex >= accessPath.length()) {
14: Object[] args = { accessPath, new Integer(startIndex) };
15: throw new Gui4jUncheckedException.ResourceError(parseCtx
16: .getConfigurationName(), parseCtx.getLineNumber(),
17: RESOURCE_ERROR_access_unexpected_end, args);
18: }
19:
20: switch (accessPath.charAt(startIndex)) {
21: case 't':
22: case 'T':
23: mValue = Boolean.TRUE;
24: break;
25: case 'f':
26: case 'F':
27: mValue = Boolean.FALSE;
28: break;
29: default: {
30: Object[] args = { accessPath, new Integer(startIndex) };
31: throw new Gui4jUncheckedException.ResourceError(parseCtx
32: .getConfigurationName(), parseCtx.getLineNumber(),
33: RESOURCE_ERROR_access_unexpected_character, args);
34: }
35: }
36: parseCtx.i = startIndex + 1;
37: }
38:
39: Class getResultClass() {
40: return Boolean.TYPE;
41: }
42:
43: public boolean isConstant() {
44: return true;
45: }
46:
47: public Object getValue(Object baseInstance, Object this Instance,
48: Map paramMap) {
49: return mValue;
50: }
51:
52: }
|