01: package org.gui4j.core.call;
02:
03: import java.util.Map;
04:
05: import org.gui4j.exception.Gui4jUncheckedException;
06:
07: final class Gui4jAccessConstant extends Gui4jAccessImpl {
08: private final String mStr;
09:
10: Gui4jAccessConstant(ParseCtx parseCtx, String accessPath) {
11: int startIndex = parseCtx.i;
12: startIndex++; // accessPath.charAt(startIndex)='\''
13: int endIndex = accessPath.indexOf('\'', startIndex);
14: if (endIndex == -1) {
15: Object[] args = { accessPath, new Integer(startIndex) };
16: throw new Gui4jUncheckedException.ResourceError(parseCtx
17: .getConfigurationName(), parseCtx.getLineNumber(),
18: RESOURCE_ERROR_access_unexpected_end, args);
19: }
20: mStr = accessPath.substring(startIndex, endIndex);
21: parseCtx.i = endIndex + 1;
22: }
23:
24: Class getResultClass() {
25: return String.class;
26: }
27:
28: public boolean isConstant() {
29: return true;
30: }
31:
32: public Object getValue(Object baseInstance, Object this Instance,
33: Map paramMap) {
34: return mStr;
35: }
36:
37: }
|